T.Tool = T.Lr.extend({
	includes: T.OQ.oQ
}),
T.drawVersion = "4.0",
T.Tool = T.Lr.extend({
	includes: T.OQ.oQ
}),
T.DO = {},
T.DO.Feature = T.Tool.extend({
	includes: T.OQ.oQ,
	initialize: function(t, i) {
		this.KE = t,
		this.ow = t.ow,
		this.dO = t.Sw.overlayPane,
		i && i.FO && (i.FO = T.s.extend({},
		this.options.FO, i.FO)),
		T.setOptions(this, i)
	},
	enable: function() {
		this.TU || (this.EQ("SE", {
			handler: this.type
		}), this.KE.EQ("draw:drawstart", {
			layerType: this.type
		}), T.Tool.prototype.enable.call(this))
	},
	disable: function() {
		this.TU && (T.Tool.prototype.disable.call(this), this.KE.EQ("draw:drawstop", {
			layerType: this.type
		}), this.EQ("disabled", {
			handler: this.type
		}))
	},
	AU: function() {
		var t = this.KE;
		t && (T.mQ.oq(), T.Pq.on(this.ow, "keyup", this.fO, this))
	},
	Sr: function() {
		this.KE && (T.mQ.pq(), T.Pq.off(this.ow, "keyup", this.fO, this))
	},
	setOptions: function(t) {
		T.setOptions(this, t)
	},
	GO: function(t) {
		this.KE.EQ("draw:created", {
			layer: t,
			layerType: this.type
		})
	},
	fO: function(t) {
		27 === t.keyCode && this.disable()
	}
}),
T.DO.Polyline = T.DO.Feature.extend({
	N: {
		TYPE: "polyline",
		gO: 1e3
	},
	Poly: T.Polyline,
	options: {
		HO: !0,
		hO: !1,
		JO: {
			color: "#b00b00",
			TO: 2500
		},
		icon: new T.DivIcon({
			iconSize: [11, 11]
		}),
		jO: 5,
		KO: 4e3,
		FO: {
			stroke: !0,
			color: "#0000FF",
			weight: 3,
			opacity: .5,
			fill: !1,
			kO: !0
		},
		lI: !0,
		LO: !0,
		zIndexOffset: 2e3
	},
	initialize: function(t, i) {
		i && i.JO && (i.JO = T.s.extend({},
		this.options.JO, i.JO)),
		this.type = T.DO.Polyline.TYPE,
		T.DO.Feature.prototype.initialize.call(this, t, i)
	},
	AU: function() {
		if (this.lO = !0, this.ZO = this.KE._U.TU, this.KE.disableDoubleClickZoom(), T.DO.Feature.prototype.AU.call(this), this.KE) {
			this.CO = [],
			this.VO || (this.VO = new T.HT),
			this.KE.addLayer(this.VO);
			var t = this.VO,
			i = this.KE;
			this.KE.on("layerremove",
			function(e) {
				t && t.hasLayer(e.layer) && (t.removeLayer(e.layer), e.layer.cO && (e.layer.cO.ME(function(t) {
					t.label && t.label.onRemove(i)
				}), e.layer.cO.clearLayers(), e.layer.cO.qq()))
			}),
			this.cO = new T.LayerGroup,
			this.KE.addLayer(this.cO),
			this.BO = new this.Poly([], this.options.FO),
			this.vO || (this.vO = T.lr(this.KE.getCenter(), {
				icon: T.Zr({
					className: "tdt-mouse-marker",
					iconAnchor: [20, 20],
					iconSize: [40, 40]
				}),
				opacity: 0,
				zIndexOffset: 6e3
			})),
			!T.PQ.ie && T.PQ.touch && T.PQ.mobile ? (this.KE.on("touchstart", this._ontouchstart, this), this.KE.on("longpress", this._onlongpress, this), this.KE.on("touchend", this._ontouchend, this), this.KE.on("move", this._onmoveStart, this), this.KE.on("moveend", this._onmoveEnd, this)) : (this.vO.on("mousedown", this.QI, this).addTo(this.KE), this.KE.on("mousemove", this.aY, this), this.KE.on("mouseup", this.NO, this), this.KE.on("dblclick ", this.bO, this)),
			this.KE.on("zoomend", this.KU, this)
		}
	},
	Sr: function() {
		T.DO.Feature.prototype.Sr.call(this),
		!T.PQ.ie && T.PQ.touch && T.PQ.mobile ? (this.KE.off("touchstart", this._ontouchstart, this), this.KE.off("longpress", this._onlongpress, this), this.KE.off("touchend", this._ontouchend, this), this.KE.off("move", this._onmoveStart, this), this.KE.off("moveend", this._onmoveEnd, this)) : (this.vO && (this.vO.off("mousedown", this.QI, this), this.vO.off("mouseup", this.WI, this), this.KE.removeLayer(this.vO), delete this.vO), this.KE.off("mousemove", this.aY, this), this.KE.off("zoomend", this.KU, this), this.MO()),
		this.KE.removeLayer(this.BO),
		delete this.BO,
		this.ZO && this.KE.enableDoubleClickZoom()
	},
	nO: function(t) {
		var i = this.KE;
		this.VO && this.VO.hasLayer(t.layer) && (this.VO.removeLayer(t.layer), t.layer.cO && (t.layer.cO.ME(function(t) {
			t.label && t.label.onRemove(i)
		}), t.layer.cO.clearLayers(), t.layer.cO.qq()))
	},
	_O: function() {
		if (! (this.CO.length <= 1)) {
			var t = this.CO.pop(),
			i = this.BO,
			e = this.BO.mO(i.jt().length - 1, 1)[0];
			this.cO.removeLayer(t),
			(i instanceof T.Polygon && i.jt() && i.jt()[0] && i.jt()[0].length < 2 || i.jt().length < 2) && this.KE.removeLayer(i),
			this.Qo(e, !1)
		}
	},
	qo: function(t) {
		this.CO.length;
		poly = this.BO,
		this.CO.push(this.Wo(t)),
		poly.ct(t),
		(poly instanceof T.Polygon && poly.jt() && poly.jt()[0] && 2 == poly.jt()[0].length || 2 == poly.jt().length) && this.KE.addLayer(this.BO),
		this.Qo(t, !0)
	},
	wo: function() {
		if (this.BO) {
			if (this.BO instanceof T.Polygon) var t = this.BO.jt()[0][0];
			else t = this.BO.jt()[0];
			var i = this.BO.Eo(t, !0);
			if (!this.options.HO && i || !this.eo()) return this.disable(),
			void(this._mouselabel && this._mouselabel.qq());
			this.GO(),
			this.disable()
		}
	},
	eo: function() {
		return ! 0
	},
	KU: function() {
		this.Ro()
	},
	aY: function(t) {
		var i = (t.layerPoint, t.lnglat);
		this.ro = i,
		this.Ro(i),
		this.vO.dr(i),
		this._mouselabel && this._mouselabel.dr && this._mouselabel.dr(i),
		T.Pq.preventDefault(t.originalEvent)
	},
	Qo: function(t, i) {
		this.To(),
		this.to(t, i),
		this.MO()
	},
	_ontouchstart: function(t) {
		this.Yo = t.containerPoint
	},
	_onlongpress: function(t) {
		this.ismoving || (this.WI(t), this.endDraw())
	},
	_ontouchend: function(t) {
		this.WI(t)
	},
	_onmoveStart: function(t) {
		this._moveStartCenter = this.KE.getCenter(),
		this.ismoving = !0
	},
	_onmoveEnd: function(t) {
		var i = this,
		e = this.KE.getCenter(),
		s = this.KE.lngLatToContainerPoint(this._moveStartCenter),
		n = this.KE.lngLatToContainerPoint(e),
		o = s.DQ(n);
		setTimeout(function() {
			o.x < 10 && o.y < 10 && (i.ismoving = !1)
		},
		301)
	},
	QI: function(t) {
		this.MO();
		var i = t.originalEvent;
		this.Yo = T.sQ(i.clientX, i.clientY)
	},
	WI: function(t) {
		if (this.BO) if (this.Yo) {
			var i = T.sQ(t.containerPoint.x, t.containerPoint.y);
			t.Uo || (t.Uo = i ? i: t.containerPoint);
			var e = t.Uo.distanceTo(this.Yo);
			Math.abs(e) < 9 * (window.pQ || 1) && this.qo(t.lnglat),
			this.Yo = null
		} else this.Yo = t.containerPoint
	},
	To: function() {
		this.CO.length
	},
	Wo: function(t) {
		var i = new T.Marker(t, {
			icon: this.options.icon,
			zIndexOffset: T.DO.Polyline.gO++
		});
		return this.uo ? i.setOpacity(1) : i.setOpacity(0),
		this.cO.addLayer(i),
		i
	},
	Io: function(t) {
		var i = {};
		for (var e in t) i[e] = "object" == typeof t[e] ? this.Io(t[e]) : t[e];
		return i
	},
	Ro: function(t) {
		if (t) {
			var i = this.CO.length;
			this.io || (this.io = new T.LayerGroup, this.KE.addLayer(this.io));
			var e = this.Io(this.options.FO);
			if (e.lineStyle = "dashed", i > 0) {
				if (t = t || this.ro, this.io.getLayers().length < 1) {
					var s = new T.Polyline([this.CO[i - 1].pE(), t], e);
					this.io.addLayer(s)
				} else this.io.getLayers()[0].kt([this.CO[i - 1].pE(), t]);
				if (this.BO instanceof T.Polygon && i > 1) if (this.io.getLayers().length < 2) {
					var s = new T.Polyline([this.CO[0].pE(), t], e);
					this.io.addLayer(s)
				} else this.io.getLayers()[1].kt([this.CO[0].pE(), t])
			}
		}
	},
	MO: function() {
		if (this.Oo) for (; this.Oo.firstChild;) this.Oo.removeChild(this.Oo.firstChild);
		this.io && this.io.getLayers().length > 0 && this.io.clearLayers()
	},
	oo: function(t, i) {
		var e, s, n, o = Math.floor(Math.sqrt(Math.pow(i.x - t.x, 2) + Math.pow(i.y - t.y, 2))),
		h = this.options.jO,
		r = this.options.KO,
		a = o > r ? o - r: h;
		for (this.Oo || (this.Oo = T.mQ.D("div", "tdt-draw-guides", this.dO)); a < o; a += this.options.jO) e = a / o,
		s = {
			x: Math.floor(t.x * (1 - e) + e * i.x),
			y: Math.floor(t.y * (1 - e) + e * i.y)
		},
		n = T.mQ.D("div", "tdt-draw-guide-dash", this.Oo),
		n.style.backgroundColor = this.options.FO.color,
		T.mQ.setPosition(n, s)
	},
	to: function(t, i) {
		var e, s, n = this.CO.length;
		1 === this.CO.length ? this.Po = 0 : (e = n - (i ? 2 : 1), s = t.distanceTo(this.CO[e].pE()), this.Po += s * (i ? 1 : -1))
	},
	po: function() {
		var t, i = this.ro,
		e = this.CO[this.CO.length - 1].pE();
		return t = this.Po + i.distanceTo(e),
		T.ao.Ao(t, this.options.lI)
	},
	So: function() {
		this.so && (clearTimeout(this.so), this.so = null)
	},
	Do: function() {
		this.CO.length > 1 && this.CO[this.CO.length - 1].off("click", this.wo, this)
	},
	GO: function() {
		var t = new this.Poly(this.BO.jt(), this.options.FO);
		T.DO.Feature.prototype.GO.call(this, t),
		this.lO = !1
	}
}),
T.DO.Polygon = T.DO.Polyline.extend({
	N: {
		TYPE: "polygon"
	},
	Poly: T.Polygon,
	options: {
		Fo: !1,
		FO: {
			stroke: !0,
			color: "#0000FF",
			weight: 3,
			opacity: .5,
			fill: !0,
			fillColor: "#0000FF",
			fillOpacity: .2,
			kO: !0
		}
	},
	initialize: function(t, i) {
		T.DO.Polyline.prototype.initialize.call(this, t, i),
		this.type = T.DO.Polygon.TYPE
	},
	AU: function() {
		T.DO.Feature.prototype.AU.call(this),
		this.KE && (this.CO = [], this.cO = new T.LayerGroup, this.KE.addLayer(this.cO), this.BO = new T.Polygon([], this.options.FO), this.vO || (this.vO = T.lr(this.KE.getCenter(), {
			icon: T.Zr({
				className: "tdt-mouse-marker",
				iconAnchor: [20, 20],
				iconSize: [40, 40]
			}),
			opacity: 0,
			zIndexOffset: 6001
		})), !T.PQ.ie && T.PQ.touch && T.PQ.mobile ? (this.KE.on("touchstart", this._ontouchstart, this), this.KE.on("longpress", this._onlongpress, this), this.KE.on("touchend", this._ontouchend, this), this.KE.on("move", this._onmoveStart, this), this.KE.on("moveend", this._onmoveEnd, this)) : (this.vO.on("mousedown", this.QI, this).addTo(this.KE), this.KE.on("mousemove", this.aY, this).on("zoomend", this.KU, this), this.KE.on("mouseup", this.NO, this), this.KE.on("dblclick ", this.bO, this)))
	},
	To: function() {
		this.CO.length
	},
	po: function() {
		var t = this.fo;
		return t ? T.ao.Go(t, this.options.lI) : null
	},
	eo: function() {
		return this.CO.length >= 3
	},
	Qo: function(t, i) {
		var e; ! this.options.HO && this.options.Fo && (e = this.BO.jt(), this.fo = T.ao.go(e)),
		T.DO.Polyline.prototype.Qo.call(this, t, i)
	},
	Do: function() {
		var t = this.CO.length;
		t > 0 && (this.CO[0].off("click", this.wo, this), t > 2 && this.CO[t - 1].off("dblclick", this.wo, this))
	}
}),
T.DO.Ho = T.DO.Feature.extend({
	options: {
		hO: !1
	},
	initialize: function(t, i) {
		T.DO.Feature.prototype.initialize.call(this, t, i)
	},
	AU: function() {
		T.DO.Feature.prototype.AU.call(this),
		this.KE && (this.ho = this.KE.aE.SE(), this.ho && this.KE.aE.disable(), this.ow.style.cursor = "crosshair", this.KE.on("mousedown", this.QI, this).on("mousemove", this.aY, this))
	},
	Sr: function() {
		T.DO.Feature.prototype.Sr.call(this),
		this.KE && (this.ho && this.KE.aE.enable(), this.ow.style.cursor = "", this.KE.off("mousedown", this.QI, this).off("mousemove", this.aY, this), T.Pq.off(document, "mouseup", this.WI, this), this.Jo && (this.KE.removeLayer(this.Jo), delete this.Jo)),
		this.jo = !1
	},
	QI: function(t) {
		this.jo = !0,
		this.Vu = t.lnglat,
		T.Pq.on(document, "mouseup", this.WI, this).preventDefault(t.originalEvent)
	},
	aY: function(t) {
		var i = t.lnglat;
		this.jo && this.Ko(i)
	},
	WI: function() {
		this.Jo && this.GO(),
		this.disable(),
		this.options.hO && this.enable()
	}
}),
T.DO.Rectangle = T.DO.Ho.extend({
	N: {
		TYPE: "rectangle"
	},
	options: {
		FO: {
			stroke: !0,
			color: "#0000FF",
			weight: 3,
			opacity: .5,
			fill: !0,
			fillColor: "#0000FF",
			fillOpacity: .2,
			kO: !0
		}
	},
	initialize: function(t, i) {
		this.type = T.DO.Rectangle.TYPE,
		T.DO.Ho.prototype.initialize.call(this, t, i)
	},
	Ko: function(t) {
		this.Jo ? this.Jo.setBounds(new T.kq(this.Vu, t)) : (this.Jo = new T.Rectangle(new T.kq(this.Vu, t), this.options.FO), this.KE.addLayer(this.Jo))
	},
	GO: function() {
		var t = new T.Rectangle(this.Jo.getBounds(), this.options.FO);
		T.DO.Ho.prototype.GO.call(this, t)
	}
}),
T.DO.Circle = T.DO.Ho.extend({
	N: {
		TYPE: "circle"
	},
	options: {
		FO: {
			stroke: !0,
			color: "#0000FF",
			weight: 3,
			opacity: .5,
			fill: !0,
			fillColor: "#0000FF",
			fillOpacity: .2,
			kO: !0
		},
		showRadius: !0,
		lI: !0
	},
	initialize: function(t, i) {
		this.type = T.DO.Circle.TYPE,
		T.DO.Ho.prototype.initialize.call(this, t, i)
	},
	Ko: function(t) {
		this.Jo ? this.Jo.setRadius(this.Vu.distanceTo(t)) : (this.Jo = new T.Circle(this.Vu, this.Vu.distanceTo(t), this.options.FO), this.KE.addLayer(this.Jo))
	},
	GO: function() {
		var t = new T.Circle(this.Vu, this.Jo.getRadius(), this.options.FO);
		T.DO.Ho.prototype.GO.call(this, t)
	},
	aY: function(t) {
		var i, e = t.lnglat;
		this.options.showRadius,
		this.options.lI;
		this.jo && (this.Ko(e), i = this.Jo.getRadius().toFixed(1))
	}
}),
T.Icon.DrawDefault = T.Icon.extend({
	options: {
		iconSize: [25, 41],
		iconAnchor: [11, 40],
		popupAnchor: [1, -41],
		shadowSize: [41, 41]
	},
	Ur: function(t) {
		var i = t + "Url";
		if (this.options[i]) return this.options[i];
		var e = T.Icon.Default.imagePath;
		return e + "/marker-" + t + (T.PQ.retina && "icon" === t ? "-2x": "") + ".png"
	}
}),
T.DO.Marker = T.DO.Feature.extend({
	N: {
		TYPE: "marker"
	},
	options: {
		icon: new T.Icon.DrawDefault,
		hO: !1,
		zIndexOffset: 2e3
	},
	initialize: function(t, i) {
		this.type = T.DO.Marker.TYPE,
		T.DO.Feature.prototype.initialize.call(this, t, i)
	},
	AU: function() {
		if (T.DO.Feature.prototype.AU.call(this), this.KE.getContainer().style.cursor = "pointer", this.KE) if (!T.PQ.ie && T.PQ.touch && T.PQ.mobile) this.KE.on("touchend", this.SY, this);
		else {
			if (!this.vO) {
				var t = T.Zr({
					className: ".tdt-mouse-marker-m",
					iconAnchor: [20, 20],
					iconSize: [40, 40]
				});
				this.vO = T.lr(this.KE.getCenter(), {
					icon: t,
					opacity: 0,
					zIndexOffset: this.options.zIndexOffset
				})
			}
			this.vO.on("click", this.SY, this).addTo(this.KE),
			this._mouselabel = new T.Label({
				text: this.text ? this.text: "点击标注",
				position: new T.Fq( - 1e4, -1e4),
				ko: [20, -9],
				className: "tdt-label-m ",
				zIndex: 4999
			}).addTo(this.KE),
			this.KE.on("mousemove", this.aY, this)
		}
	},
	Sr: function() {
		T.DO.Feature.prototype.Sr.call(this),
		this.KE && (T.PQ.touch && T.PQ.mobile ? this.KE.off("touchend", this.SY, this) : (this.KE.getContainer().style.cursor = "", this._mouselabel.qq(), this.oI && (this.oI.off("click", this.SY, this), this.KE.off("click", this.SY, this).removeLayer(this.oI), delete this.oI), this.vO.off("click", this.SY, this), this.KE.removeLayer(this.vO), delete this.vO, this.KE.off("mousemove", this.aY, this)))
	},
	aY: function(t) {
		var i = t.lnglat;
		this.vO.dr(i),
		!T.PQ.ie && T.PQ.touch && T.PQ.mobile || this._mouselabel.dr(i),
		this.oI ? (i = this.vO.pE(), this.oI.dr(i)) : (this.oI = new T.Marker(i, {
			icon: this.options.icon,
			zIndexOffset: this.options.zIndexOffset - 1
		}), this.oI.on("click", this.SY, this), this.oI.setOpacity(0), this.KE.on("click", this.SY, this).addLayer(this.oI)),
		this.follow && this.oI.setOpacity(1)
	},
	SY: function(t) {
		this.GO(t),
		this.disable()
	},
	GO: function(t) {
		var i = new T.Marker(this.oI.pE(), {
			icon: this.options.icon
		});
		T.DO.Feature.prototype.GO.call(this, i)
	}
}),
T.Lo = T.Lo || {},
T.Lo.Poly = T.Tool.extend({
	options: {
		icon: new T.DivIcon({
			iconSize: [11, 11],
			className: "tdt-div-icon-black tdt-editing-icon"
		})
	},
	initialize: function(t, i) {
		this.BO = t,
		T.setOptions(this, i),
		this.lo = T.Polygon && this.BO instanceof T.Polygon
	},
	AU: function() {
		this.BO.KE && (this.cO || this.Zo(), this.BO.KE.addLayer(this.cO))
	},
	Sr: function() {
		this.BO.KE && (this.BO.KE.removeLayer(this.cO), delete this.cO, delete this.CO)
	},
	Co: function() {
		this.cO.clearLayers(),
		this.Zo()
	},
	Zo: function() {
		this.cO || (this.cO = new T.LayerGroup),
		this.CO = [];
		var t, i, e, s, n = this.BO.Kt;
		for (this.lo && (n = n[0]), t = 0, e = n.length; t < e; t++) s = this.Wo(n[t], t),
		this.CO.push(s);
		var o, h;
		for (t = 0, i = e - 1; t < e; i = t++)(0 !== t || T.Polygon && this.BO instanceof T.Polygon) && (o = this.CO[i], h = this.CO[t], this.Vo(o, h), this.co(o, h))
	},
	_createMidMarker: function(t, i, e) {
		var s = new T.DivIcon({
			iconSize: [11, 11],
			className: e + " tdt-editing-icon"
		}),
		n = new T.Marker(t, {
			draggable: !0,
			icon: s
		});
		return n.Bo = t,
		n.vo = i,
		n.on("drag", this.No, this),
		n.on("dragend", this.bo, this),
		this.cO.addLayer(n),
		n
	},
	Wo: function(t, i, e) {
		var s = e ? new T.DivIcon({
			iconSize: [11, 11],
			className: e + " tdt-editing-icon"
		}) : this.options.icon,
		n = new T.Marker(t, {
			draggable: !0,
			icon: s
		});
		return n.Bo = t,
		n.vo = i,
		n.on("drag", this.No, this),
		n.on("dragend", this.bo, this),
		this.cO.addLayer(n),
		n
	},
	Mo: function(t) {
		var i = t.vo;
		this.cO.removeLayer(t),
		this.CO.splice(i, 1),
		this.BO.mO(i, 1),
		this.no(i, -1),
		t.off("drag", this.No, this).off("dragend", this.bo, this)
	},
	bo: function(t) {
		var i = t.target;
		i.setIcon(this.options.icon),
		this.BO.edited = !0,
		this.BO.EQ("edit"),
		this.MO(),
		this.BO.redraw()
	},
	No: function(t) {
		var i = t.target;
		T.extend(i.Bo, i.pr),
		i._o && i._o.dr(this.mo(i.QP, i)),
		i.qP && i.qP.dr(this.mo(i, i.WP));
		var e = [];
		if (i._o || i.qP) {
			for (var s = 0,
			n = this.BO instanceof T.Polygon ? this.BO.jt()[0] : this.BO.jt(); s < n.length && !n[s].equals(i.pE()); s++);
			var o = s - 1 < 0 ? 0 : s - 1,
			t = s + 2 > n.length ? n.length: s + 2;
			e = n.slice(o, t),
			this.BO instanceof T.Polygon && 2 == e.length && (0 == o ? e.splice(0, 0, n[n.length - 1]) : n.length == t && e.splice(n.length - 1, n.length - 1, n[0]))
		} else {
			for (var h, r, a = 0; a < this.cO.getLayers().length; a++) this.cO.getLayers()[a]._o === i && (h = this.cO.getLayers()[a]),
			this.cO.getLayers()[a].qP === i && (r = this.cO.getLayers()[a]);
			e = [h.pE(), i.pE(), r.pE()]
		}
		this.Ro(e)
	},
	Io: function(t) {
		var i = {};
		for (var e in t) i[e] = "object" == typeof t[e] ? this.Io(t[e]) : t[e];
		return i
	},
	Ro: function(t) {
		if (this._guideLine) this._guideLine.kt(t);
		else {
			var i = {};
			i.color = this.BO.options.color,
			i.lineStyle = "dashed",
			i.weight = this.BO.options.weight,
			this._guideLine = new T.Polyline(t, i),
			this.BO.KE.addLayer(this._guideLine)
		}
	},
	MO: function() {
		this._guideLine && (this._guideLine.kt([]), this._guideLine.redraw())
	},
	wP: function(t) {
		var i = this.lo,
		e = i ? 4 : 3,
		s = t.target; (i ? this.BO.Kt[0] : this.BO.Kt).length < e || (this.Mo(s), this.co(s.QP, s.WP), s._o && this.cO.removeLayer(s._o), s.qP && this.cO.removeLayer(s.qP), s.QP && s.WP ? this.Vo(s.QP, s.WP) : s.QP ? s.WP || (s.QP.qP = null) : s.WP._o = null, this.bo())
	},
	no: function(t, i) {
		this.cO.ME(function(e) {
			e.vo > t && (e.vo += i)
		})
	},
	Vo: function(t, i) {
		var e, s, n, o = this.mo(t, i),
		h = this._createMidMarker(o, null, "tdt-div-icon-transparent-border");
		t.qP = i._o = h,
		s = function() {
			var e = i.vo;
			h.vo = e,
			o.lat = h.pE().lat,
			o.lng = h.pE().lng,
			this.BO.mO(e, 0, o),
			this.CO.splice(e, 0, h),
			this.no(e, 1),
			i.vo++,
			this.co(t, h),
			this.co(h, i),
			this.BO.EQ("editstart")
		},
		n = function() {
			h.off("dragstart", s, this),
			h.off("dragend", n, this),
			this.Vo(t, h),
			this.Vo(h, i)
		},
		e = function() {
			s.call(this),
			n.call(this),
			this.bo()
		},
		h.on("dragstart", s, this).on("dragend", n, this),
		this.cO.addLayer(h)
	},
	co: function(t, i) {
		t && (t.WP = i),
		i && (i.QP = t)
	},
	mo: function(t, i) {
		var e = this.BO.KE,
		s = e._q(t.pE()),
		n = e._q(i.pE());
		return e.mq(s.SQ(n).fQ(2))
	}
});
var initHook = function() {
	this.Lt || (T.Lo.Poly && (this.Lt = new T.Lo.Poly(this), this.options.editable && this.Lt.enable()), this.on("aQ",
	function() {
		this.Lt && this.Lt.SE() && this.Lt.AU()
	}), this.on("remove",
	function() {
		this.Lt && this.Lt.SE() && this.Lt.Sr()
	}))
};
T.Polyline.m(initHook),
T.Polygon.m(initHook),
T.Polyline.n({
	mO: function(t, i, e) {
		var s, n = this.Kt;
		return s = e ? n.splice(t, i, e) : n.splice(t, i),
		this.redraw(),
		s
	}
}),
T.Polygon.n({
	mO: function(t, i, e) {
		var s, n = this.Kt[0];
		return s = e ? n.splice(t, i, e) : n.splice(t, i),
		this.redraw(),
		s
	}
}),
T.Lo.Ho = T.Tool.extend({
	options: {
		EP: new T.DivIcon({
			iconSize: [11, 11],
			className: "tdt-div-icon-black tdt-editing-icon tdt-edit-move"
		}),
		eP: new T.DivIcon({
			iconSize: [11, 11],
			className: "tdt-div-icon-black tdt-editing-icon tdt-edit-resize"
		})
	},
	initialize: function(t, i) {
		this.Jo = t,
		T.s.setOptions(this, i)
	},
	AU: function() {
		this.Jo.KE && (this.KE = this.Jo.KE, this.cO || this.Zo(), this.KE.addLayer(this.cO))
	},
	Sr: function() {
		if (this.Jo.KE) {
			this.RP(this.rP);
			for (var t = 0,
			i = this.TP.length; t < i; t++) this.RP(this.TP[t]);
			this.TP = null,
			this.KE.removeLayer(this.cO),
			delete this.cO
		}
		this.KE = null
	},
	Co: function() {
		this.cO.clearLayers(),
		this.Zo()
	},
	Zo: function() {
		this.cO || (this.cO = new T.LayerGroup),
		this.tP(),
		this.YP()
	},
	tP: function() {},
	YP: function() {},
	Wo: function(t, i) {
		var e = new T.Marker(t, {
			draggable: !0,
			icon: i,
			zIndexOffset: 1e3
		});
		return this.UP(e),
		this.cO.addLayer(e),
		e
	},
	UP: function(t) {
		t.on("dragstart", this.uP, this).on("drag", this.No, this).on("dragend", this.IP, this)
	},
	RP: function(t) {
		t.off("dragstart", this.uP, this).off("drag", this.No, this).off("dragend", this.IP, this)
	},
	uP: function(t) {
		var i = t.target;
		i.setOpacity(0),
		this.Jo.EQ("editstart")
	},
	bo: function() {
		this.Jo.edited = !0,
		this.Jo.EQ("edit")
	},
	No: function(t) {
		var i = t.target,
		e = i.pE();
		i === this.rP ? this.qE(e) : this.iP(e),
		this.Jo.redraw()
	},
	IP: function(t) {
		var i = t.target;
		i.setOpacity(1),
		this.bo()
	},
	qE: function() {},
	iP: function() {}
}),
T.Lo.Rectangle = T.Lo.Ho.extend({
	tP: function() {
		var t = this.Jo.getBounds(),
		i = t.getCenter();
		this.rP = this.Wo(i, this.options.EP)
	},
	YP: function() {
		var t = this.OP();
		this.TP = [];
		for (var i = 0,
		e = t.length; i < e; i++) this.TP.push(this.Wo(t[i], this.options.eP)),
		this.TP[i].oP = i
	},
	uP: function(t) {
		T.Lo.Ho.prototype.uP.call(this, t);
		var i = this.OP(),
		e = t.target,
		s = e.oP;
		this.PP = i[(s + 2) % 4],
		this.pP(0, s)
	},
	IP: function(t) {
		var i, e, s = t.target;
		s === this.rP && (i = this.Jo.getBounds(), e = i.getCenter(), s.dr(e)),
		this.pP(1),
		this.AP(),
		T.Lo.Ho.prototype.IP.call(this, t)
	},
	qE: function(t) {
		for (var i, e = this.Jo.jt(), s = this.Jo.getBounds(), n = s.getCenter(), o = [], h = 0, r = e.length; h < r; h++) {
			o.push([]);
			for (var a = 0,
			u = e[h].length; a < u; a++) i = [e[h][a].lat - n.lat, e[h][a].lng - n.lng],
			o[h].push([t.lat + i[0], t.lng + i[1]])
		}
		this.Jo.kt(o),
		this.AP()
	},
	iP: function(t) {
		var i;
		this.Jo.setBounds(T.Kq(t, this.PP)),
		i = this.Jo.getBounds(),
		this.rP.dr(i.getCenter())
	},
	OP: function() {
		var t = this.Jo.getBounds(),
		i = t.Cq(),
		e = t.getNorthEast(),
		s = t.Bq(),
		n = t.getSouthWest();
		return [i, e, s, n]
	},
	pP: function(t) {
		for (var i = 0,
		e = this.TP.length; i < e; i++) this.TP[i].setOpacity(t)
	},
	AP: function() {
		for (var t = this.OP(), i = 0, e = this.TP.length; i < e; i++) this.TP[i].dr(t[i])
	}
}),
T.Rectangle.m(function() {
	T.Lo.Rectangle && (this.Lt = new T.Lo.Rectangle(this), this.options.editable && this.Lt.enable())
}),
T.Lo.Circle = T.Lo.Ho.extend({
	tP: function() {
		var t = this.Jo.pE();
		this.rP = this.Wo(t, this.options.EP)
	},
	YP: function() {
		var t = this.Jo.pE(),
		i = this.aP(t);
		this.TP = [],
		this.TP.push(this.Wo(i, this.options.eP))
	},
	aP: function(t) {
		var i = this.KE._q(t);
		return this.KE.mq([i.x + this.Jo.rY, i.y])
	},
	qE: function(t) {
		var i = this.aP(t);
		this.TP[0].dr(i),
		this.Jo.dr(t)
	},
	iP: function(t) {
		var i = this.rP.pE(),
		e = i.distanceTo(t);
		this.Jo.setRadius(e)
	}
}),
T.Circle.m(function() {
	T.Lo.Circle && (this.Lt = new T.Lo.Circle(this), this.options.editable && this.Lt.enable()),
	this.on("aQ",
	function() {
		this.Lt && this.Lt.SE() && this.Lt.AU()
	}),
	this.on("remove",
	function() {
		this.Lt && this.Lt.SE() && this.Lt.Sr()
	})
}),
T.SP = {
	sP: function(t) {
		for (var i = [], e = 0, s = t.length; e < s; e++) i.push(this.DP(t[e]));
		return i
	},
	DP: function(t) {
		return t.AQ()
	}
},
T.ao = T.extend(T.ao || {},
{
	go: function(t) {
		var i, e, s = t.length,
		n = 0,
		o = Math.PI / 180;
		if (s > 2) {
			for (var h = 0; h < s; h++) i = t[h],
			e = t[(h + 1) % s],
			n += (e.lng - i.lng) * o * (2 + Math.sin(i.lat * o) + Math.sin(e.lat * o));
			n = 6378137 * n * 6378137 / 2
		}
		return Math.abs(n)
	},
	Go: function(t, i) {
		var e;
		return i ? e = t >= 1e4 ? (1e-4 * t).toFixed(2) + " ha": t.toFixed(2) + " m&sup2;": (t *= .836127, e = t >= 3097600 ? (t / 3097600).toFixed(2) + " mi&sup2;": t >= 4840 ? (t / 4840).toFixed(2) + " acres": Math.ceil(t) + " yd&sup2;"),
		e
	},
	Ao: function(t, i) {
		var e;
		return i ? e = t > 1e3 ? (t / 1e3).toFixed(2) + " km": Math.ceil(t) + " m": (t *= 1.09361, e = t > 1760 ? (t / 1760).toFixed(2) + " miles": Math.ceil(t) + " yd"),
		e
	}
}),
T.s.extend(T.Ot, {
	dP: function(t, i, e, s) {
		return this.FP(t, e, s) !== this.FP(i, e, s) && this.FP(t, i, e) !== this.FP(t, i, s)
	},
	FP: function(t, i, e) {
		return (e.y - t.y) * (i.x - t.x) > (i.y - t.y) * (e.x - t.x)
	}
}),
T.Polyline.n({
	intersects: function() {
		var t, i, e, s = this.Vt[0],
		n = s ? s.length: 0;
		if (this.fP()) return ! 1;
		for (t = n - 1; t >= 3; t--) if (i = s[t - 1], e = s[t], this.GP(i, e, t - 2)) return ! 0;
		return ! 1
	},
	Eo: function(t, i) {
		return !! this.KE && this.gP(this.KE.Lw(t), i)
	},
	gP: function(t, i) {
		var e = this.Vt[0],
		s = e ? e.length: 0,
		n = e ? e[s - 1] : null,
		o = s - 2;
		return ! this.fP(1) && this.GP(n, t, o, i ? 1 : 0)
	},
	fP: function(t) {
		var i = this.Vt[0],
		e = i ? i.length: 0;
		return e += t || 0,
		!this.Vt[0] || e <= 3
	},
	GP: function(t, i, e, s) {
		var n, o, h = this.Vt[0];
		s = s || 0;
		for (var r = e; r > s; r--) if (n = h[r - 1], o = h[r], T.Ot.dP(t, i, n, o)) return ! 0;
		return ! 1
	}
}),
T.Polygon.n({
	intersects: function() {
		var t, i, e, s, n, o = this.Vt[0];
		return ! this.fP() && ( !! (t = T.Polyline.prototype.intersects.call(this)) || (i = o.length, e = o[0], s = o[i - 1], n = i - 2, this.GP(s, e, n, 1)))
	}
}),
T.MarkTool = T.DO.Marker.extend({
	options: {
		follow: !1
	},
	initialize: function(t, i) {
		this.follow = i && i.follow ? i.follow: this.options.follow,
		this.options.hO = !1,
		T.DO.Marker.prototype.initialize.call(this, t, i),
		this.HP || (this.HP = new T.HT),
		t.addLayer(this.HP);
		var e = this.HP;
		t.on("layerremove",
		function(t) {
			e && e.hasLayer(t.layer) && e.removeLayer(t.layer)
		})
	},
	aY: function(t) {
		T.DO.Marker.prototype.aY.call(this, t)
	},
	GO: function(t) {
		this.vO ? this.hP = new T.Marker(this.vO.pE(), {
			icon: this.options.icon
		}) : this.hP = new T.Marker(t.lnglat, {
			icon: this.options.icon
		}),
		T.DO.Feature.prototype.GO.call(this, this.hP),
		this.HP.addLayer(this.hP),
		this.EQ("mouseup", {
			currentLnglat: this.hP.pE(),
			currentMarker: this.hP,
			allMarkers: this.getMarkers()
		})
	},
	setPointImage: function(t) {
		var i = T.ir({
			iconUrl: t,
			iconSize: [20, 30],
			iconAnchor: [8, 29]
		});
		this.options.icon = i
	},
	clear: function() {
		this.HP.ME(function(t) {
			t.qq()
		})
	},
	getMarkers: function() {
		return this.HP.getLayers()
	},
	getMarkControlPoint: function() {
		return null == this.hP ? null: this.hP.pE()
	},
	JP: function() {
		this.HP.ME(function(t) {
			t instanceof T.Marker && t.aE.enable()
		})
	},
	jP: function() {
		this.HP.ME(function(t) {
			t instanceof T.Marker && t.aE.disable()
		})
	},
	enable: function() {
		this.TU || (T.DO.Marker.prototype.enable.call(this), this.hP = null)
	},
	open: function() {
		this.enable()
	},
	close: function() {
		this.disable()
	}
}),
T.RectangleTool = T.DO.Rectangle.extend({
	initialize: function(t, i) {
		i && (i.color && (this.options.FO.color = i.color), i.weight && (this.options.FO.weight = i.weight), i.opacity && (this.options.FO.opacity = i.opacity), i.fillColor && (this.options.FO.fillColor = i.fillColor), i.fillOpacity && (this.options.FO.fillOpacity = i.fillOpacity), i.lineStyle && (this.options.FO.lineStyle = i.lineStyle)),
		T.DO.Rectangle.prototype.initialize.call(this, t, i),
		this.HP || (this.HP = new T.HT),
		t.addLayer(this.HP);
		var e = this.HP;
		t.on("layerremove",
		function(t) {
			e && e.hasLayer(t.layer) && e.removeLayer(t.layer)
		})
	},
	AU: function() {
		T.DO.Rectangle.prototype.AU.call(this)
	},
	GO: function() {
		var t = new T.Rectangle(this.Jo.getBounds(), this.options.FO);
		T.DO.Ho.prototype.GO.call(this, t),
		this.HP.addLayer(t),
		this.EQ("draw", {
			currentBounds: t.getBounds(),
			currentRectangle: t,
			allRectangles: this.getRectangles()
		}),
		t.redraw()
	},
	clear: function() {
		this.HP.ME(function(t) {
			t.qq()
		})
	},
	getRectangles: function() {
		return this.HP.getLayers()
	},
	open: function() {
		this.enable()
	},
	close: function() {
		this.disable()
	}
}),
T.CircleTool = T.DO.Circle.extend({
	initialize: function(t, i) {
		i && (i.color && (this.options.FO.color = i.color), i.fillColor && (this.options.FO.fillColor = i.fillColor), i.weight && (this.options.FO.weight = i.weight), i.opacity && (this.options.FO.opacity = i.opacity), i.fillOpacity && (this.options.FO.fillOpacity = i.fillOpacity), i.lineStyle && (this.options.FO.lineStyle = i.lineStyle)),
		T.DO.Circle.prototype.initialize.call(this, t, i),
		this.HP || (this.HP = new T.HT),
		t.addLayer(this.HP);
		var e = this.HP;
		t.on("layerremove",
		function(t) {
			e && e.hasLayer(t.layer) && e.removeLayer(t.layer)
		})
	},
	GO: function() {
		var t = new T.Circle(this.Vu, this.Jo.getRadius(), this.options.FO);
		T.DO.Ho.prototype.GO.call(this, t),
		this.HP.addLayer(t);
		var i = this.Jo.getRadius();
		this.EQ("drawend", {
			currentCenter: this.Vu,
			currentRadius: i,
			currentCircle: t,
			allCircles: this.getCircles()
		}),
		t.redraw()
	},
	aY: function(t) {
		if (T.DO.Circle.prototype.aY.call(this, t), this.Jo) {
			var i = this.Jo.getRadius(),
			e = new T.Circle(this.Vu, this.Jo.getRadius(), this.options.FO);
			this.EQ("draw", {
				currentCenter: this.Vu,
				currentRadius: i,
				currentCircle: e,
				allCircles: this.getCircles()
			})
		}
	},
	getCircles: function() {
		return this.HP.getLayers()
	},
	clear: function() {
		this.HP.ME(function(t) {
			t.qq()
		})
	},
	open: function() {
		this.enable()
	},
	close: function() {
		this.disable()
	}
}),
T.PolylineTool = T.DO.Polyline.extend({
	initialize: function(t, i) {
		i && (i.color && (this.options.FO.color = i.color), i.weight && (this.options.FO.weight = i.weight), i.opacity && (this.options.FO.opacity = i.opacity), i.lineStyle && (this.options.FO.lineStyle = i.lineStyle), i.showLabel ? (this.uo = i.showLabel, this.options.hO = !1) : this.options.hO = !0),
		T.DO.Polyline.prototype.initialize.call(this, t, i),
		this.options.HO = !0,
		this.options.icon = T.Zr({
			className: "tdt-img3"
		})
	},
	AU: function() {
		T.DO.Polyline.prototype.AU.call(this)
	},
	bO: function() {
		this.cO.getLayers().length < 2 && this.disable(),
		this.isdb = !1,
		this.lO = !1,
		this.wo()
	},
	Sr: function() {
		var t = this.KE;
		this.lO && (this._mouselabel && this._mouselabel.qq(), this.cO.ME(function(i) {
			i.label && i.label.onRemove(t),
			i.qq()
		})),
		map.off("mouseup", this.NO, this),
		this.uo || this.cO.ME(function(t) {
			t.qq()
		}),
		T.DO.Polyline.prototype.Sr.call(this);
		map.off("dblclick ", this.bO, this)
	},
	NO: function(t) {
		function i(t) {
			return function() {
				0 == e.isdb && e.WI(t)
			}
		}
		this.isdb = !1;
		var e = this;
		t.Uo = T.sQ(t.originalEvent.clientX, t.originalEvent.clientY),
		window.setTimeout(i(t), 50)
	},
	GO: function() {
		this._mouselabel && this._mouselabel.qq();
		var t = new this.Poly(this.BO.jt(), this.options.FO);
		t.uo = this.uo;
		var i = this.cO.getLayers().length,
		e = t.cO = this.cO,
		s = this;
		if (T.DO.Feature.prototype.GO.call(this, t), this.VO.addLayer(t), e.getLayers().length > 0 && (e.ME(function(i) {
			i.label && i.label.KP("tdt-img1", i,
			function() {
				if (index = 0, 2 == e.getLayers().length) return void t.qq();
				for (; index < e.getLayers().length && e.getLayers()[index] !== i; index++);
				t.mO(index, 1),
				i.label.onRemove(s.KE),
				e.removeLayer(i),
				s.kP(t)
			})
		}), i > 1)) {
			var n = e.getLayers()[i - 1];
			n.label && (n.label.setBorderLine(.5), n.label.setBorderColor("#CE0000"), n.label.ow.childNodes[0].innerText = " 总长：" + (this.getDistance(t.jt()) / 1e3).toFixed(3) + " 公里 ", n.label.KP("tdt-img2", t,
			function() {
				t.qq()
			}))
		}
		this.EQ("draw", {
			currentLnglats: t.getLngLats(),
			currentDistance: this.getDistance(t.jt()),
			currentPolyline: t,
			allPolylines: this.getPolylines()
		}),
		t.redraw()
	},
	kP: function(t) {
		var i = t.cO.getLayers();
		for (index = 0; index < i.length; index++) if (i[index].label) {
			var e = i[index].label;
			if ("SPAN" == e.ow.childNodes[0].tagName) if (0 == index) e.ow.childNodes[0].innerText = "起点";
			else {
				var s = t.jt().slice(0, index + 1);
				e.ow.childNodes[0].innerText = (this.getDistance(s) / 1e3).toFixed(3) + " 公里",
				index == i.length - 1 && (e.setBorderLine(.5), e.setBorderColor("#CE0000"), e.ow.childNodes[0].innerText = "总长： " + e.ow.childNodes[0].innerText, e.ow.childNodes.length < 3 && e.KP("tdt-img2", t,
				function() {
					t.qq()
				}))
			}
		}
	},
	Wo: function(t) {
		var i = T.DO.Polyline.prototype.Wo.call(this, t);
		if (1 == this.cO.getLayers().length && (T.PQ.ie || !T.PQ.mobile ? this._mouselabel = new T.Label({
			text: this.text ? this.text: "双击结束",
			position: i.getLngLat(),
			ko: [10, 10],
			className: "tdt-label1",
			zIndex: 5e3
		}).addTo(this.KE) : (this._mouselabel = new T.Control.PadTipControl({}).addTo(this.KE), this._mouselabel.setContext("长按结束" + (this.options.showLabel ? "测距": "画线")), this._mouselabel.setCenter())), this.cO.getLayers().length > 0 && this.uo) {
			var e = "";
			if (1 == this.cO.getLayers().length) e = "<span>起点<span>";
			else {
				var s = this.BO.jt().slice(0);
				s.push(i.pE()),
				e = "<span style='display: inline-block;text-align:center;margin:0 auto;'>" + (this.getDistance(s) / 1e3).toFixed(3) + " 公里<span>"
			}
			if (e) {
				var n = new T.Label({
					text: e,
					position: i.getLngLat(),
					ko: [10, -15],
					className: "tdt-label1 ",
					zIndex: T.DO.Polyline.gO++
				}).addTo(this.KE);
				i.label = n
			}
		}
		return i
	},
	qo: function(t) {
		T.DO.Polyline.prototype.qo.call(this, t),
		this.EQ("addpoint", {
			currentLnglats: this.BO.getLngLats(),
			currentDistance: this.getDistance(this.BO.jt()),
			currentPolyline: this.BO,
			allPolylines: this.getPolylines()
		})
	},
	setTips: function(t) {
		this.text = t
	},
	getDistance: function(t) {
		var e = 0;
		for (i = 0; i < t.length - 1; i++) e += t[i].distanceTo(t[i + 1]);
		return e + ""
	},
	endDraw: function() {
		this.isdb = !1,
		this.lO = !1,
		this.wo()
	},
	clear: function() {
		this.VO.ME(function(t) {
			t.qq()
		})
	},
	getPolylines: function() {
		return this.VO.getLayers()
	},
	open: function() {
		this.enable()
	},
	close: function() {
		this.disable()
	}
}),
T.PolygonTool = T.DO.Polygon.extend({
	initialize: function(t, i) {
		i && (i.color && (this.options.FO.color = i.color), i.weight && (this.options.FO.weight = i.weight), i.opacity && (this.options.FO.opacity = i.opacity), i.fillColor && (this.options.FO.fillColor = i.fillColor), i.fillOpacity && (this.options.FO.fillOpacity = i.fillOpacity), i.lineStyle && (this.options.FO.lineStyle = i.lineStyle), i.showLabel && (this.uo = i.showLabel)),
		T.DO.Polygon.prototype.initialize.call(this, t, i)
	},
	AU: function() {
		T.DO.Polygon.prototype.AU.call(this),
		this.LP || (this.LP = new T.HT),
		this.KE.addLayer(this.LP);
		var t = this.LP;
		this.KE.on("layerremove",
		function(i) {
			t && t.hasLayer(i.layer) && i.layer && i.layer.lP && (i.layer.lP.qq(), t.removeLayer(i.layer))
		}),
		this._U = this.KE._U.TU,
		this.KE._U.disable(),
		this.lO = !0,
		this.lP = null
	},
	Sr: function() {
		T.DO.Polygon.prototype.Sr.call(this),
		this.lO && (this._mouselabel && this._mouselabel.qq(), this.lP && this.lP.qq()),
		this.cO.ME(function(t) {
			t.label && t.label.onRemove(pmap),
			t.qq()
		}),
		map.off("mouseup", this.NO, this),
		this._U && this.KE._U.enable(),
		map.off("dblclick ", this.bO, this)
	},
	bO: function() {
		this.cO.getLayers().length < 2 && this.disable(),
		this.isdb = !1,
		this.lO = !1,
		this.wo()
	},
	NO: function(t) {
		function i(t) {
			return function() {
				0 == e.isdb && e.WI(t)
			}
		}
		this.isdb = !1;
		var e = this;
		t.Uo = T.sQ(t.originalEvent.clientX, t.originalEvent.clientY),
		window.setTimeout(i(t), 50)
	},
	Wo: function(t) {
		var i = new T.Marker(t, {
			icon: this.options.icon,
			zIndexOffset: T.DO.Polyline.gO++
		});
		if (i.setOpacity(0), this.cO.addLayer(i), 1 == this.cO.getLayers().length && (T.PQ.ie || !T.PQ.mobile ? this._mouselabel = new T.Label({
			text: this.text ? this.text: "双击结束",
			position: i.getLngLat(),
			ko: [10, 10],
			className: "tdt-label1 ",
			zIndex: 4999
		}).addTo(this.KE) : (this._mouselabel = new T.Control.PadTipControl({}).addTo(this.KE), this._mouselabel.setContext("长按结束" + (this.options.showLabel ? "测面": "画面")), this._mouselabel.setCenter())), this.uo) {
			var e = this.cO.getLayers().length,
			s = this.BO.jt()[0].slice(0);
			s.push(i.getLngLat());
			var n = (this.getArea(s) / 1e6).toFixed(3) + "平方千米";
			3 == e && (this.lP = new T.Label({
				text: "<span style='display: inline-block;text-align:center;margin:0 auto;'>" + n + " </span>",
				position: i.getLngLat(),
				ko: [10, -15],
				className: "tdt-label1 ",
				zIndex: T.DO.Polyline.gO++
			}).addTo(this.KE)),
			e > 3 && (this.lP.ow.childNodes[0].innerText = n, this.lP.dr(i.getLngLat()))
		}
		return i
	},
	GO: function() {
		var t = new this.Poly(this.BO.jt(), this.options.FO);
		if (t.uo = this.uo, T.DO.Feature.prototype.GO.call(this, t), this.LP.addLayer(t), this.EQ("draw", {
			currentLnglats: t.getLngLats()[0],
			currentArea: this.getArea(t.jt()[0]),
			currentPolygon: t,
			allPolygons: this.getPolygons()
		}), this._mouselabel && this._mouselabel.qq(), this.uo && this.lP) {
			this.lP.setBorderLine(.5),
			this.lP.setBorderColor("#CE0000"),
			this.lP.ow.childNodes[0].innerText = "总面积：" + this.lP.ow.childNodes[0].innerText;
			t.lP = this.lP,
			this.lP.KP("tdt-img2", t,
			function() {
				t.qq()
			})
		}
		t.redraw()
	},
	qo: function(t) {
		T.DO.Polygon.prototype.qo.call(this, t),
		this.EQ("addpoint", {
			currentPolygon: this.BO,
			currentLnglats: this.BO.getLngLats()[0],
			currentArea: this.getArea(this.BO.jt()),
			allPolygons: this.getPolygons()
		})
	},
	setTips: function(t) {
		this.text = t
	},
	getPolygons: function() {
		return this.LP.getLayers()
	},
	getArea: function(t) {
		return T.ao.go(t)
	},
	endDraw: function() {
		this.isdb = !1,
		this.lO = !1,
		this.wo()
	},
	clear: function() {
		this.LP.ME(function(t) {
			t.qq()
		})
	},
	open: function() {
		this.enable()
	},
	close: function() {
		this.disable()
	}
}),
T.Control.PadTipControl = T.Control.extend({
	initialize: function(t) {
		this.setOptions(t)
	},
	onAdd: function(t) {
		this.map = t;
		var i = this.div = T.mQ.D("a", "tdt-noDataTips"),
		e = this.left = T.mQ.D("a", "tdt-tabtop_left", i);
		e.style.color = "#FFFFFF";
		var s = T.mQ.D("a", "tdt-tabtop_rt", i);
		return self = this,
		s.onclick = function() {
			t.removeControl(self)
		},
		i
	},
	setCenter: function() {
		this.div.style.marginRight = (this.map.ow.offsetWidth - this.div.offsetWidth) / 2 + "px"
	},
	setContext: function(t) {
		this.left.innerHTML = t
	},
	onRemove: function(t) {
		var i = this.div.parentNode;
		i && (i.removeChild(this.div), this.map = null, this.div = null)
	}
}),
T.labelVersion = "0.2.2-dev",
T.Label = T.Overlay.extend({
	includes: T.OQ.oQ,
	options: {
		type: 1,
		className: "",
		kO: !1,
		ZP: "right",
		CP: !1,
		ko: [12, -15],
		offset: new T.Point(0, 0),
		opacity: 1,
		Mr: !1
	},
	initialize: function(t, i) {
		if (T.setOptions(this, t), this.nr = i, this.VP = T.PQ.any3d && this.options.Mr, this.cP = !1, t && (t.text && this.setContent(t.text), t.position && this.setLngLat(t.position), this.options.zIndex && (this.Kr = this.options.zIndex), t.offset && t.offset instanceof T.Point)) {
			this.options.offset = t.offset;
			var e = this.options.offset;
			this.options.ko = [e.x + 12, e.y - 15]
		}
		this.options.kO = !0,
		this.options.CP = !0
	},
	onAdd: function(t) {
		this.KE = t,
		this.Hu = this.options.JE ? t.Sw[this.options.JE] : this.nr instanceof T.Marker ? t.Sw.markerPane: t.Sw.popupPane,
		this.ow || this.dW(),
		this.Hu.appendChild(this.ow),
		this.jr(),
		this.oe(),
		this.setOpacity(this.options.opacity),
		t.on("moveend", this.tE, this).on("viewreset", this.BP, this),
		this.VP && t.on("ge", this.vP, this),
		T.PQ.touch && !this.options.CP && (T.Pq.on(this.ow, "click", this.close, this), t.on("click", this.close, this))
	},
	onRemove: function(t) {
		this.Hu.removeChild(this.ow),
		t.off({
			ge: this.vP,
			moveend: this.tE,
			viewreset: this.BP
		},
		this),
		this.NP(),
		this.EQ("remove", {}),
		this.KE = null
	},
	dr: function(t) {
		return this.pr = T.Gq(t),
		this.KE && this.ET(),
		this
	},
	setContent: function(t) {
		return this.bP = this.RT,
		this.RT = t,
		this.rT(),
		this
	},
	getElement: function() {
		return this.ow
	},
	close: function() {
		var t = this.KE;
		t && (T.PQ.touch && !this.options.CP && (T.Pq.off(this.ow, "click", this.close), t.off("click", this.close, this)), t.removeLayer(this))
	},
	MP: function(t) {
		this.Kr = t,
		this.ow && this.Kr && (this.ow.style.zIndex = t)
	},
	setOpacity: function(t) {
		this.options.opacity = t,
		this.ow && T.mQ.setOpacity(this.ow, t)
	},
	dW: function() {
		this.options.className ? this.ow = T.mQ.D("div", this.options.className + " tdt-zoom-animated") : this.ow = T.mQ.D("div", "tdt-label  tdt-zoom-animated"),
		this.MP(this.Kr)
	},
	oe: function() {
		this.KE && (this.ow.style.visibility = "hidden", this.rT(), this.ET(), this.ow.style.visibility = "")
	},
	rT: function() {
		this.RT && this.KE && this.nP !== this.RT && "string" == typeof this.RT && (this.ow.innerHTML = this.RT, this.nP = this.RT, this._labelWidth = this.ow.offsetWidth)
	},
	ET: function() {
		var t = this.KE.Lw(this.pr);
		this._P(t)
	},
	_P: function(t) {
		var i = this.KE,
		e = this.ow,
		s = i.vW(i.getCenter()),
		n = i.Cw(t),
		o = this.options.ZP,
		h = this._labelWidth,
		r = T.sQ(this.options.ko);
		"right" === o || "auto" === o && n.x < s.x ? (T.mQ.rq(e, "tdt-label-right"), T.mQ.tq(e, "tdt-label-left"), t = t.aQ(r)) : (T.mQ.rq(e, "tdt-label-left"), T.mQ.tq(e, "tdt-label-right"), t = t.aQ(T.sQ( - r.x - h, r.y))),
		T.mQ.setPosition(e, t)
	},
	vP: function(t) {
		var i = this.KE.dE(this.pr, t.zoom, t.center).JQ();
		this._P(i)
	},
	tE: function() {
		this.VP && "auto" !== this.options.ZP || this.ET()
	},
	BP: function(t) {
		t && t.hard && this.oe()
	},
	jr: function() {
		var t = this.ow,
		i = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
		T.mQ.rq(t, "tdt-clickable"),
		T.Pq.on(t, "click", this.mP, this);
		for (var e = 0; e < i.length; e++) T.Pq.on(t, i[e], this.Qp, this)
	},
	NP: function() {
		var t = this.ow,
		i = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
		T.mQ.tq(t, "tdt-clickable"),
		T.Pq.off(t, "click", this.mP, this);
		for (var e = 0; e < i.length; e++) T.Pq.off(t, i[e], this.Qp, this)
	},
	mP: function(t) {
		this.iQ(t.type) && T.Pq.stopPropagation(t);
		var i = this.KE.vW(this.pr);
		this.EQ(t.type, {
			lnglat: this.pr,
			containerPoint: i
		})
	},
	Qp: function(t) {
		var i = this.KE.vW(this.pr);
		this.EQ(t.type, {
			lnglat: this.pr,
			containerPoint: i
		}),
		"contextmenu" === t.type && this.iQ(t.type) && T.Pq.preventDefault(t),
		"mousedown" !== t.type ? T.Pq.stopPropagation(t) : T.Pq.preventDefault(t)
	},
	getType: function() {
		return 1
	},
	getLngLat: function() {
		return this.pr
	},
	setLngLat: function(t) {
		return this.pr = T.Gq(t),
		this.KE && this.ET(),
		this
	},
	setOffset: function(t) {
		return t && t instanceof T.Point && (this.options.offset = t, this.options.ko = [t.x + 12, t.y - 15]),
		this.KE && this.ET(),
		this
	},
	getOffset: function() {
		return this.offset_Point
	},
	setLabel: function(t) {
		this.setContent(t)
	},
	getLabel: function() {
		this.getContent()
	},
	setTitle: function(t) {
		return this.qp = t,
		this.ow || this.dW(),
		this.ow.title = this.qp,
		this
	},
	getTitle: function() {
		return this.qp
	},
	setZindex: function(t) {
		this.MP(t)
	},
	getFontSize: function(t) {
		return this.ow.style.fontSize
	},
	setFontSize: function(t) {
		return this._FontSize = t,
		this.ow || this.dW(),
		this.ow.style.fontSize = this._FontSize + "pt",
		this
	},
	setFontColor: function(t) {
		return this.Wp = t,
		this.ow || this.dW(),
		this.ow.style.color = this.Wp,
		this
	},
	getFontColor: function() {
		return this.ow.style.color
	},
	setBackgroundColor: function(t) {
		return t || (t = "transparent"),
		this.wp = t,
		this.ow || this.dW(),
		this.ow.style.backgroundColor = this.wp,
		this
	},
	getBackgroundColor: function() {
		return this.ow.style.backgroundColor
	},
	setBorderLine: function(t) {
		return this.Ep = t,
		this.ow || this.dW(),
		this.ow.style.borderWidth = this.Ep + "pt",
		this.ow.style.boxShadow = "0px 0px 0px 0px",
		this
	},
	getBorderLine: function() {
		return this.ow.style.borderWidth
	},
	setBoxShadow: function(t) {
		return this.ow.style.boxShadow = t,
		this
	},
	getBoxShadow: function() {
		return this.ow.style.boxShadow
	},
	setBorderColor: function(t) {
		return t || (t = "transparent"),
		this.Wp = t,
		this.ow || this.dW(),
		this.ow.style.borderColor = this.Wp,
		this
	},
	getBorderColor: function() {
		return this.ow.style.borderColor
	},
	setOpacity: function(t) {
		this.ep = t,
		this.ow && T.mQ.setOpacity(this.ow, this.ep)
	},
	getOpacity: function() {
		return this.ep
	},
	KP: function(t, i, e) {
		var s = this.ow,
		n = T.mQ.D("a", t, s);
		T.Pq.on(n, "click", e)
	}
}),
T.Rp = {
	showLabel: function() {
		return this.label && this.KE && (this.label.dr(this.pr), this.KE.showLabel(this.label)),
		this
	},
	hideLabel: function() {
		return this.label && this.label.close(),
		this
	},
	rp: function(t) {
		this.Tp !== t && (this.Tp = t, t ? (this.tp(), this.showLabel()) : (this.Yp(), this.hideLabel()))
	},
	Up: function(t, i) {
		var e = this.options.icon ? this.options.icon.options.up: this.options.up,
		s = T.sQ(e) || T.sQ(0, 0);
		return s = s.aQ(T.Label.prototype.options.ko),
		i && i.ko && (s = s.aQ(i.ko)),
		i = T.s.extend({
			ko: s
		},
		i),
		this.Tp = i.CP,
		this.label || (this.Tp || this.Yp(), this.on("remove", this.hideLabel, this).on("move", this.Ip, this).on("aQ", this.ip, this), this.Op = !0),
		this.label = new T.Label(i, this).setContent(t),
		this
	},
	op: function() {
		return this.label && (this.hideLabel(), this.label = null, this.Op && (this.Tp || this.tp(), this.off("remove", this.hideLabel, this).off("move", this.Ip, this).off("aQ", this.ip, this)), this.Op = !1),
		this
	},
	Pp: function(t) {
		this.label && this.label.setContent(t)
	},
	getLabel: function() {
		return this.label
	},
	ip: function() {
		this.Tp && this.showLabel()
	},
	Yp: function() {
		this.on("mouseover", this.showLabel, this).on("mouseout", this.hideLabel, this),
		T.PQ.touch && this.on("click", this.showLabel, this)
	},
	tp: function() {
		this.off("mouseover", this.showLabel, this).off("mouseout", this.hideLabel, this),
		T.PQ.touch && this.off("click", this.showLabel, this)
	},
	Ip: function(t) {
		this.label.dr(t.lT)
	}
},
T.Icon.Default._({
	up: new T.Point(9, -20)
}),
T.Marker._({
	icon: new T.Icon.Default
}),
T.Marker.n(T.Rp),
T.Marker.n({
	pp: T.Marker.prototype.De,
	De: function(t) {
		var i = this.Kr + t;
		this.pp(t),
		this.label && this.label.MP(i)
	},
	Ap: T.Marker.prototype.setOpacity,
	setOpacity: function(t, i) {
		this.options.ap = i,
		this.Ap(t)
	},
	Sp: T.Marker.prototype.se,
	se: function() {
		var t = 0 === this.options.opacity ? 0 : 1;
		this.Sp(),
		this.label && this.label.setOpacity(this.options.ap ? this.options.opacity: t)
	},
	sp: T.Marker.prototype.dr,
	dr: function(t) {
		return this.label && !this.Tp && this.hideLabel(),
		this.sp(t)
	}
}),
T.RY._({
	up: new T.Point(0, 0)
}),
T.RY.n(T.Rp),
T.LT.n({
	Up: function(t, i) {
		return this.label && this.label.options === i || (this.label = new T.Label(i, this)),
		this.label.setContent(t),
		this.Dp || (this.on("mouseover", this.uo, this).on("mousemove", this.Ip, this).on("mouseout remove", this.dp, this), T.PQ.touch && this.on("click", this.uo, this), this.Dp = !0),
		this
	},
	op: function() {
		return this.label && (this.dp(), this.label = null, this.Dp = !1, this.off("mouseover", this.uo, this).off("mousemove", this.Ip, this).off("mouseout remove", this.dp, this)),
		this
	},
	Pp: function(t) {
		this.label && this.label.setContent(t)
	},
	uo: function(t) {
		this.label.dr(t.lT),
		this.KE.showLabel(this.label)
	},
	Ip: function(t) {
		this.label.dr(t.lT)
	},
	dp: function() {
		this.label.close()
	}
}),
T.Map.n({
	showLabel: function(t) {
		return this.addLayer(t)
	}
}),
T.HT.n({
	clearLayers: function() {
		return this.op(),
		this.ME(this.removeLayer, this),
		this
	},
	Up: function(t, i) {
		return this.ZT("Up", t, i)
	},
	op: function() {
		return this.ZT("op")
	},
	Pp: function(t) {
		this.ZT("Pp", t)
	}
}),
T.Control.Fp = T.Control.extend({
	options: {
		position: "bottomright",
		fp: !1,
		Gp: -4,
		gp: !1,
		Hp: !1,
		Mr: !1,
		hp: !1,
		Jp: !1,
		width: 140,
		height: 140,
		jp: 18,
		Kp: 18,
		kp: {
			weight: 2,
			kO: !1,
			opacity: .4,
			fillOpacity: .2,
			color: "#0066cc",
			fillColor: "blue"
		},
		Lp: {
			weight: 2,
			kO: !1,
			opacity: 0,
			fillOpacity: 0,
			color: "#0066cc",
			fillColor: "blue"
		},
		lp: {
			Zp: "隐藏",
			Cp: "打开"
		},
		mapOptions: {}
	},
	initialize: function(t) {
		T.s.setOptions(this, t),
		this.options.kp.kO = !1,
		this.options.Lp.kO = !1,
		this.fp = !0
	},
	onAdd: function(t) {
		this.Vp = t,
		this._containerBorder = T.mQ.D("div", "tdt-control-minimap-edge"),
		this._minimapContainer = this.ow = T.mQ.D("div", "tdt-control-minimap"),
		this._containerBorder.appendChild(this.ow),
		T.Pq.PT(this._containerBorder),
		T.Pq.on(this._containerBorder, "mousewheel", T.Pq.stopPropagation);
		var i = null;
		if (this.Vp.getMapType()) {
			for (var e = this.Vp.getMapType().getLayers(), s = [], n = 0; n < e.length; n++) {
				var o = new T.TileLayer("", e[n].options);
				o.getTileUrl = e[n].getTileUrl,
				s.push(o)
			}
			i = new T.MapType(s, this.Vp.getMapType().getName())
		}
		var h = {
			BE: !1,
			aE: !this.options.Hp,
			gI: !1,
			qu: !1,
			_U: !1,
			Mr: !1,
			hp: this.options.hp,
			ku: this.options.Hp ? "center": !this.cp(),
			sE: !this.cp(),
			iW: t.options.iW,
			layers: i
		};
		return h = T.s.extend(this.options.mapOptions, h),
		this.Bp = new T.Map(this.ow, h),
		this.Vp.on("maptypechange", this.mapTypeChange, this),
		this.vp = !1,
		this.Np = !1,
		this.bp = !1,
		this.Mp = this.options.Jp,
		this.options.fp && this.np(),
		this.Bp.DE(T.s.d(function() {
			this._p = T.eY(this.Vp.getBounds(), this.options.kp).addTo(this.Bp),
			renderRectoptions = {
				nW: 30
			},
			this.renderRect = new T.SVG(renderRectoptions),
			this.options.Lp.OW = this.renderRect,
			this.mp = T.eY(this.Vp.getBounds(), this.options.Lp).addTo(this.Bp),
			this.Vp.on("moveend", this.QA, this),
			this.Vp.on("move", this.qA, this),
			this.Bp.on("movestart", this.WA, this),
			this.Bp.on("move", this.wA, this),
			this.Bp.on("moveend", this.EA, this),
			this.Bp.on("dblclick", this._onMiniMapDblclick, this),
			T.PQ.ie && (T.Pq.on(this.Bp.getContainer(), "mousedown",
			function() {
				this.Bp.getContainer().setCapture()
			},
			this), T.Pq.on(this.Bp.getContainer(), "mouseup",
			function() {
				this.Bp.getContainer().releaseCapture()
			},
			this))
		},
		this)),
		this._containerBorder
	},
	mapTypeChange: function(t) {
		var i = null;
		if (t.mapType) {
			for (var e = t.mapType.getLayers(), s = [], n = 0; n < e.length; n++) {
				var o = new T.TileLayer("", e[n].options);
				o.getTileUrl = e[n].getTileUrl,
				s.push(o)
			}
			i = new T.MapType(s, this.Vp.getMapType().getName()),
			this.Bp.setMapType(i)
		}
	},
	addTo: function(t) {
		T.Control.prototype.addTo.call(this, t);
		var i = this.options.Hp || this.Vp.getCenter();
		return i && this.Bp.HW(i, this.eA(!0)),
		this.RA(this.rA()),
		this
	},
	onRemove: function(t) {
		this.Vp.off("moveend", this.QA, this),
		this.Vp.off("move", this.qA, this),
		this.Bp.off("moveend", this.EA, this)
	},
	np: function() {
		this.TA = this.options.fp ? this.sI("", this.options.lp.Zp, "tdt-control-minimap-toggle-display tdt-control-minimap-toggle-display-" + this.options.position, this._minimapContainer, this.tA, this) : void 0,
		this.TA.style.width = this.options.jp + "px",
		this.TA.style.height = this.options.Kp + "px"
	},
	sI: function(t, i, e, s, n, o) {
		var h = T.mQ.D("a", e, s);
		h.innerHTML = t,
		h.href = "#",
		h.title = i;
		var r = T.Pq.stopPropagation;
		return T.Pq.on(h, "click", r).on(h, "mousedown", r).on(h, "dblclick", r).on(h, "click", T.Pq.preventDefault).on(h, "click", n, o),
		h
	},
	tA: function() {
		this.bp = !0,
		this.Mp ? (this.UA(), this.TA.title = this.options.lp.Zp) : (this.YA(), this.TA.title = this.options.lp.Cp)
	},
	RA: function(t) {
		t !== this.Mp && (this.Mp ? this.UA() : this.YA())
	},
	YA: function() {
		this.options.fp ? (this._minimapContainer.style.width = this.options.jp + "px", this._minimapContainer.style.height = this.options.Kp + "px", this.TA.className += " minimized-" + this.options.position) : (this.ow.style.display = "none", this._containerBorder.style.display = "none"),
		this.Mp = !0
	},
	UA: function() {
		this.options.fp ? (this._minimapContainer.style.width = this.options.width + "px", this._minimapContainer.style.height = this.options.height + "px", this.TA.className = this.TA.className.replace("minimized-" + this.options.position, "")) : (this.ow.style.display = "block", this._containerBorder.style.display = "block"),
		this.Mp = !1
	},
	QA: function(t) {
		if (this.Np) this.Np = !1;
		else {
			var i = this.options.Hp || this.Vp.getCenter();
			this.vp = !0,
			this.Bp.HW(i, this.eA(!0)),
			this.RA(this.rA())
		}
		this._p.setBounds(this.Vp.getBounds())
	},
	qA: function(t) {
		this._p.setBounds(this.Vp.getBounds())
	},
	WA: function(t) {
		if (!this.options.Hp) {
			var i = this._p.getBounds(),
			e = this.Bp.vW(i.getSouthWest()),
			s = this.Bp.vW(i.getNorthEast()),
			n = this.Bp.vW(i.getCenter()),
			o = Math.abs(i.getSouthWest().lng - i.getNorthEast().lng),
			h = Math.abs(i.getSouthWest().lat - i.getNorthEast().lat);
			this._lastAimingRectPosition = {
				sw: e,
				ne: s,
				ce: n,
				coWidth: o,
				coHeight: h
			}
		}
	},
	_onMiniMapDblclick: function(t) {
		this.Bp.panTo(t.lnglat)
	},
	wA: function(t) {
		if (!this.options.Hp && !this.vp && this._lastAimingRectPosition) {
			var i = this.Bp.getCenter().lng + this._lastAimingRectPosition.coWidth / 2,
			e = this.Bp.getCenter().lng - this._lastAimingRectPosition.coWidth / 2,
			s = this.Bp.getCenter().lat + this._lastAimingRectPosition.coHeight / 2,
			n = this.Bp.getCenter().lat - this._lastAimingRectPosition.coHeight / 2;
			this.mp.setBounds(new T.kq(new T.Fq(n, e), new T.Fq(s, i))),
			this._p.er({
				opacity: .2,
				fillOpacity: .2
			}),
			this.mp.er({
				opacity: .6,
				fillOpacity: .3
			})
		}
	},
	EA: function(t) {
		this.vp ? this.vp = !1 : (this.Np = !0, this.Vp.HW(this.Bp.getCenter(), this.eA(!1)), this.mp.er({
			opacity: 0,
			fillOpacity: 0
		}), this._p.er({
			opacity: .4,
			fillOpacity: .2
		}))
	},
	cp: function() {
		var t = this.options.gp;
		return this.uA(t) && this.IA(t)
	},
	eA: function(t) {
		if (this.cp()) return t ? this.options.gp: this.Vp.getZoom();
		if (t) return this.Vp.getZoom() + this.options.Gp;
		var i, e = this.Bp.getZoom() - this.Vp.getZoom(),
		s = this.Bp.getZoom() - this.options.Gp;
		return e > this.options.Gp && this.Vp.getZoom() < this.Bp.getMinZoom() - this.options.Gp ? this.Bp.getZoom() > this._lastMiniMapZoom ? (i = this.Vp.getZoom() + 1, this.Bp.setZoom(this.Bp.getZoom() - 1)) : i = this.Vp.getZoom() : i = s,
		this._lastMiniMapZoom = this.Bp.getZoom(),
		i
	},
	rA: function() {
		return this.bp ? this.Mp: this.options.hp ? !!this.Vp.getBounds().contains(this.Bp.getBounds()) : this.Mp
	},
	IA: function(t) {
		return "number" == typeof t
	},
	uA: function(t) {
		return "undefined" != typeof t
	}
}),
T.Map._({
	iA: !1
}),
T.Map.m(function() {
	this.options.iA && (this.iA = (new MiniMap).addTo(this))
}),
T.Control.OverviewMap = T.Control.Fp.extend({
	includes: T.OQ.oQ,
	options: {
		anchor: "TMAP_ANCHOR_BOTTOM_RIGH",
		size: new T.sQ(150, 150),
		isOpen: !1
	},
	initialize: function(t) {
		t && (t.size && (this.options.width = t.size.x, this.options.height = t.size.y), this.cP = t.isOpen, this.Mp = t.isOpen),
		this.options.fp = !0,
		T.Control.Fp.prototype.initialize.call(this, t)
	},
	onAdd: function(t) {
		var i = T.Control.Fp.prototype.onAdd.call(this, t);
		this.cP ? this.UA() : this.YA();
		var e = T.Icon.Default.imagePath;
		return this.setButtonImage(e + "/Open.png", e + "/Close.png"),
		i
	},
	setButtonImage: function(t, i) {
		this.ButtonImageUrl = "url(" + t + ")",
		this.ButtonImageReverseUrl = "url(" + i + ")",
		this.cP ? T.PQ.ielt9 && (this.TA.style.backgroundImage = this.ButtonImageUrl) : T.PQ.ielt9 && (this.TA.style.backgroundImage = this.ButtonImageReverseUrl),
		T.PQ.ielt9 || (this.TA.style.backgroundImage = this.ButtonImageUrl)
	},
	_setButtonImage: function(t) {
		return this.TA.style.backgroundImage = "url(" + t + ")",
		this
	},
	setBorderColor: function(t) {
		this._minimapContainer.style.borderColor = t
	},
	setBorderWidth: function(t) {
		this._minimapContainer.style.borderWidth = t + "px"
	},
	setRectBorderColor: function(t) {
		this.options.kp.color = t,
		this.options.kp.fillColor = t,
		this._p.er(this.options.kp)
	},
	setRectBackColor: function(t) {
		this.options.Lp.color = t,
		this.options.Lp.fillColor = t,
		this.mp.er(this.options.Lp)
	},
	tA: function() {
		T.Control.Fp.prototype.tA.call(this),
		this.EQ("viewchange", {
			isOpen: !this.Mp
		}),
		this.cP = !this.Mp,
		this.cP ? this.ButtonImageUrl && (this.TA.style.backgroundImage = this.ButtonImageUrl) : this.ButtonImageReverseUrl && (this.TA.style.backgroundImage = this.ButtonImageReverseUrl)
	},
	changeView: function() {
		this.tA()
	},
	isOpen: function() {
		return ! this.Mp
	},
	getMiniMap: function() {
		return this.Bp
	}
}),
T.OA = T.HT.extend({
	options: {
		oA: 80,
		PA: null,
		pA: !1,
		AA: !0,
		aA: !0,
		SA: !1,
		sA: null,
		DA: !0,
		tw: !1,
		dA: !1,
		FA: 1,
		fA: {
			weight: 1.5,
			color: "#222",
			opacity: .5
		},
		GA: !1,
		gA: 200,
		HA: 50,
		hA: null,
		JA: {}
	},
	initialize: function(t) {
		T.s.setOptions(this, t),
		this.options.PA || this.setStyles(this.options.styles, !0),
		this.jA = T.VT(),
		this.jA.tQ(this),
		this.KA = T.VT(),
		this.KA.tQ(this),
		this.kA = 0,
		this.LA = [],
		this.lA = [],
		this.ZA = null,
		this.CA = [];
		var i = T.mQ.iq && this.options.tw;
		T.extend(this, i ? this.VA: this.cA),
		this.BA = i ? T.vA: T.NA
	},
	addLayer: function(t) {
		if (t instanceof T.LayerGroup) return this.addLayers([t]);
		if (!t.pE) return this.KA.addLayer(t),
		this;
		if (!this.KE) return this.LA.push(t),
		this;
		if (this.hasLayer(t)) return this;
		this.bA && this.bA(),
		this.ei(t, this.MA),
		this._A.nA();
		var i = t,
		e = this.KE.getZoom();
		if (t.mA) for (; i.mA.GW >= e;) i = i.mA;
		return this.ZA.contains(i.pE()) && (this.options.dA ? this.Qa(t, i) : this.qa(t, i)),
		this._viewChangeEndNotClustering(),
		this
	},
	removeLayer: function(t) {
		return t instanceof T.LayerGroup ? this.removeLayers([t]) : t.pE ? this.KE ? t.mA ? (this.bA && (this.bA(), this.wa(t)), this.Ea(t, !0), this._A.nA(), t.off("move", this.ea, this), this.jA.hasLayer(t) && (this.jA.removeLayer(t), t.Ra && t.Ra()), this) : this: (!this.Wa(this.LA, t) && this.hasLayer(t) && this.lA.push(t), this) : (this.KA.removeLayer(t), this)
	},
	addLayers: function(t) {
		if (!T.s.Z(t)) return this.addLayer(t);
		var i, e = this.jA,
		s = this.KA,
		n = this.options.GA,
		o = this.options.gA,
		h = this.options.hA,
		r = t.length,
		a = 0,
		u = !0;
		if (this.KE) {
			var l = (new Date).getTime(),
			c = T.d(function() {
				for (var f = (new Date).getTime(); a < r; a++) {
					if (n && a % 200 === 0) {
						var p = (new Date).getTime() - f;
						if (p > o) break
					}
					if (i = t[a], i instanceof T.LayerGroup) u && (t = t.slice(), u = !1),
					this.ra(i, t),
					r = t.length;
					else if (i.pE) {
						if (!this.hasLayer(i) && (this.ei(i, this.MA), i.mA && 2 === i.mA.Ta())) {
							var d = i.mA.ta(),
							m = d[0] === i ? d[1] : d[0];
							e.removeLayer(m)
						}
					} else s.addLayer(i)
				}
				h && h(a, r, (new Date).getTime() - l),
				a === r ? (this._A.nA(), this.jA.ME(function(t) {
					t instanceof T.vA && t.Ya && t.Ua()
				}), this._A.ua(null, this.GW, this.ZA)) : setTimeout(c, this.options.HA)
			},
			this);
			c(),
			this._viewChangeEndNotClustering()
		} else for (var f = this.LA; a < r; a++) i = t[a],
		i instanceof T.LayerGroup ? (u && (t = t.slice(), u = !1), this.ra(i, t), r = t.length) : i.pE ? this.hasLayer(i) || f.push(i) : s.addLayer(i);
		return this
	},
	removeLayers: function(t) {
		var i, e, s = t.length,
		n = this.jA,
		o = this.KA,
		h = !0;
		if (!this.KE) {
			for (i = 0; i < s; i++) e = t[i],
			e instanceof T.LayerGroup ? (h && (t = t.slice(), h = !1), this.ra(e, t), s = t.length) : (this.Wa(this.LA, e), o.removeLayer(e), this.hasLayer(e) && this.lA.push(e));
			return this
		}
		if (this.bA) {
			this.bA();
			var r = t.slice(),
			a = s;
			for (i = 0; i < a; i++) e = r[i],
			e instanceof T.LayerGroup ? (this.ra(e, r), a = r.length) : this.wa(e)
		}
		for (i = 0; i < s; i++) e = t[i],
		e instanceof T.LayerGroup ? (h && (t = t.slice(), h = !1), this.ra(e, t), s = t.length) : e.mA ? (this.Ea(e, !0, !0), n.hasLayer(e) && (n.removeLayer(e), e.Ra && e.Ra())) : o.removeLayer(e);
		return this._A.nA(),
		this._A.ua(null, this.GW, this.ZA),
		n.ME(function(t) {
			t instanceof T.vA && t.Ua()
		}),
		this
	},
	clearLayers: function() {
		return this.KE || (this.LA = [], delete this.Ia, delete this.ia),
		this.Oa && this.Oa(),
		this.jA.clearLayers(),
		this.KA.clearLayers(),
		this.ME(function(t) {
			t.off("move", this.ea, this),
			delete t.mA
		}),
		this.KE && this.oa(),
		this
	},
	getBounds: function() {
		var t = new T.kq;
		this._A && t.extend(this._A.qr);
		for (var i = this.LA.length - 1; i >= 0; i--) t.extend(this.LA[i].pE());
		return t.extend(this.KA.getBounds()),
		t
	},
	ME: function(t, i) {
		var e, s = this.LA.slice(),
		n = this.lA;
		for (this._A && this._A.ta(s), e = s.length - 1; e >= 0; e--) n.indexOf(s[e]) === -1 && t.call(i, s[e]);
		this.KA.ME(t, i)
	},
	getLayers: function() {
		var t = [];
		return this.ME(function(i) {
			t.push(i)
		}),
		t
	},
	getLayer: function(t) {
		var i = null;
		return t = parseInt(t, 10),
		this.ME(function(e) {
			T.F(e) === t && (i = e)
		}),
		i
	},
	hasLayer: function(t) {
		if (!t) return ! 1;
		var i, e = this.LA;
		for (i = e.length - 1; i >= 0; i--) if (e[i] === t) return ! 0;
		for (e = this.lA, i = e.length - 1; i >= 0; i--) if (e[i] === t) return ! 1;
		return ! (!t.mA || t.mA.Pa !== this) || this.KA.hasLayer(t)
	},
	pa: function(t, i) {
		"function" != typeof i && (i = function() {});
		var e = function() { ! t.Gr && !t.mA.Gr || this.kA || (this.KE.off("moveend", e, this), this.off("animationend", e, this), t.Gr ? i() : t.mA.Gr && (this.TQ("spiderfied", i, this), t.mA.Aa()))
		};
		if (t.Gr && this.KE.getBounds().contains(t.pE())) i();
		else if (t.mA.GW < this.KE.getZoom()) this.KE.on("moveend", e, this),
		this.KE.panTo(t.pE());
		else {
			var s = function() {
				this.KE.off("movestart", s, this),
				s = null
			};
			this.KE.on("movestart", s, this),
			this.KE.on("moveend", e, this),
			this.on("animationend", e, this),
			t.mA.aa(),
			s && e.call(this)
		}
	},
	onAdd: function(t) {
		this.KE = t;
		var i, e, s;
		if (!isFinite(this.KE.getMaxZoom())) throw "Map has no maxZoom specified";
		for (this.jA.addTo(t), this.KA.addTo(t), this.Ia || this.oa(), this.Sa = t.options.iW.projection.qW, i = 0, e = this.lA.length; i < e; i++) s = this.lA[i],
		this.Ea(s, !0);
		this.lA = [],
		this.GW = this.KE.getZoom(),
		this.ZA = this.sa(),
		this.KE.on("zoomend", this.Da, this),
		this.KE.on("moveend", this.QE, this),
		this.da && this.da(),
		this.Fa(),
		e = this.LA,
		this.LA = [],
		this.addLayers(e)
	},
	onRemove: function(t) {
		t.off("zoomend", this.Da, this),
		t.off("moveend", this.QE, this),
		this.fa(),
		this.KE.Pw.className = this.KE.Pw.className.replace(" tdt-cluster-anim", ""),
		this.Ga && this.Ga(),
		delete this.Sa,
		this.ga(),
		this.jA.qq(),
		this.KA.qq(),
		this.jA.clearLayers(),
		this.KE = null
	},
	Ha: function(t) {
		for (var i = t; i && !i.Gr;) i = i.mA;
		return i || null
	},
	Wa: function(t, i) {
		for (var e = t.length - 1; e >= 0; e--) if (t[e] === i) return t.splice(e, 1),
		!0
	},
	ha: function(t, i) {
		for (var e = this.KE,
		s = this.ia; i >= 0 && s[i].Ja(t, e._q(t.pE(), i)); i--);
	},
	ea: function(t) {
		this.ja || (t.target.pr = t.Ka, this.removeLayer(t.target), t.target.pr = t.lT, this.addLayer(t.target))
	},
	Ea: function(t, i, e) {
		var s = this.Ia,
		n = this.ia,
		o = this.jA,
		h = this.KE;
		i && this.ha(t, this.MA);
		var r, a = t.mA,
		u = a.CO;
		for (this.Wa(u, t); a && (a.ka--, a.La = !0, !(a.GW < 0));) i && a.ka <= 1 ? (r = a.CO[0] === t ? a.CO[1] : a.CO[0], s[a.GW].Ja(a, h._q(a.la, a.GW)), n[a.GW].Za(r, h._q(r.pE(), a.GW)), this.Wa(a.mA.Ca, a), a.mA.CO.push(r), r.mA = a.mA, a.Gr && (o.removeLayer(a), e || o.addLayer(r))) : e && a.Gr || a.Ua(),
		a = a.mA;
		delete t.mA
	},
	Va: function(t, i) {
		for (; i;) {
			if (t === i) return ! 0;
			i = i.parentNode
		}
		return ! 1
	},
	EQ: function(t, i, e) {
		if (i && i.layer instanceof T.vA) {
			if (i.originalEvent && this.Va(i.layer.Gr, i.originalEvent.relatedTarget)) return;
			t = "cluster" + t
		}
		T.HT.prototype.EQ.call(this, t, i, e)
	},
	eQ: function(t, i) {
		return T.HT.prototype.eQ.call(this, t, i) || T.HT.prototype.eQ.call(this, "cluster" + t, i)
	},
	ca: function(t) {
		var i = t.Ta(),
		e = " marker-cluster-";
		return e += i < 10 ? "small1": i < 100 ? "medium1": "large1",
		new T.DivIcon({
			html: "<div><span>" + i + "</span></div>",
			className: "marker-cluster" + e,
			iconSize: new T.Point(40, 40)
		})
	},
	Fa: function() {
		var t = this.KE,
		i = this.options.pA,
		e = this.options.AA,
		s = this.options.aA; (i || s) && this.on("clusterclick", this.Ba, this),
		e && (this.on("clustermouseover", this.va, this), this.on("clustermouseout", this.ga, this), t.on("zoomend", this.ga, this))
	},
	Ba: function(t) {
		var i = t.layer,
		e = i;
		return 1 === e.Ca.length ? void this.KE.centerAndZoom(e.pr, this.KE.getZoom() + 1) : (e.GW === this.MA && e.ka === i.ka && this.options.pA ? i.Aa() : this.options.aA && i.aa(), void(t.originalEvent && 13 === t.originalEvent.keyCode && this.KE.ow.focus()))
	},
	va: function(t) {
		var i = this.KE;
		this.kA || (this.Na && i.removeLayer(this.Na), t.layer.Ta() > 2 && t.layer !== this.ba && (this.Na = new T.Polygon(t.layer.Ma(), this.options.JA), i.addLayer(this.Na)))
	},
	ga: function() {
		this.Na && (this.KE.removeLayer(this.Na), this.Na = null)
	},
	fa: function() {
		var t = this.options.pA,
		i = this.options.AA,
		e = this.options.aA,
		s = this.KE; (t || e) && this.off("clusterclick", this.Ba, this),
		i && (this.off("clustermouseover", this.va, this), this.off("clustermouseout", this.ga, this), s.off("zoomend", this.ga, this))
	},
	Da: function() {
		this.KE && (this.na(), this.GW = Math.round(this.KE.GW), this.ZA = this.sa())
	},
	QE: function() {
		if (!this.kA) {
			var t = this.sa();
			this._A._a(this.ZA, this.GW, t),
			this._A.ua(null, Math.round(this.KE.GW), t),
			this.ZA = t
		}
	},
	oa: function() {
		var t = this.KE.getMaxZoom(),
		i = this.options.oA,
		e = i;
		"function" != typeof i && (e = function() {
			return i
		}),
		this.options.sA && (t = this.options.sA - 1),
		this.MA = t,
		this.Ia = {},
		this.ia = {};
		for (var s = t; s >= 0; s--) this.Ia[s] = new T.ma(e(s)),
		this.ia[s] = new T.ma(e(s));
		this._A = new this.BA(this, -1)
	},
	ei: function(t, i) {
		var e, s, n = this.Ia,
		o = this.ia;
		for (this.options.SA && this.QS(t), t.on("move", this.ea, this); i >= 0; i--) {
			e = this.KE._q(t.pE(), i);
			var h = n[i].qS(e);
			if (h) return h.WS(t),
			void(t.mA = h);
			if (h = o[i].qS(e)) {
				var r = h.mA;
				r && this.Ea(h, !1);
				var a = new this.BA(this, i, h, t);
				n[i].Za(a, this.KE._q(a.la, i)),
				h.mA = a,
				t.mA = a;
				var u = a;
				for (s = i - 1; s > r.GW; s--) u = new this.BA(this, s, u),
				n[s].Za(u, this.KE._q(h.pE(), s));
				return r.WS(u),
				void this.ha(h, i)
			}
			o[i].Za(t, e)
		}
		this._A.WS(t),
		t.mA = this._A
	},
	wS: function(t) {
		this.CA.push(t),
		this.ES || (this.ES = setTimeout(T.d(this.eS, this), 300))
	},
	eS: function() {
		for (var t = 0; t < this.CA.length; t++) this.CA[t].call(this);
		this.CA.length = 0,
		clearTimeout(this.ES),
		this.ES = null
	},
	na: function() {
		var t = Math.round(this.KE.GW);
		this.eS(),
		this.GW < t && this.ZA.intersects(this.sa()) ? (this.RS(), this._A._a(this.ZA, this.GW, this.sa()), this.rS(this.GW, t)) : this.GW > t ? (this.RS(), this.TS(this.GW, t)) : this.QE()
	},
	sa: function() {
		return this.options.DA ? T.PQ.mobile ? this.YS(this.KE.getBounds()) : this.YS(this.KE.getBounds().Zq(1)) : this.tS
	},
	YS: function(t) {
		var i = this.Sa;
		return void 0 !== i && (t.Vq() >= i && (t.lq.lat = 1 / 0), t.vq() <= -i && (t.Lq.lat = -(1 / 0))),
		t
	},
	qa: function(t, i) {
		if (i === t) this.jA.addLayer(t);
		else if (2 === i.ka) {
			i.US();
			var e = i.ta();
			this.jA.removeLayer(e[0]),
			this.jA.removeLayer(e[1])
		} else i.Ua()
	},
	ra: function(t, i) {
		var e, s = t.getLayers(),
		n = 0;
		for (i = i || []; n < s.length; n++) e = s[n],
		e instanceof T.LayerGroup ? this.ra(e, i) : i.push(e);
		return i
	},
	QS: function(t) {
		var i = t.options.icon = this.options.PA({
			Ta: function() {
				return 1
			},
			ta: function() {
				return [t]
			}
		});
		return i
	}
}),
T.OA.n({
	tS: new T.kq(new T.Fq( - (1 / 0), -(1 / 0)), new T.Fq(1 / 0, 1 / 0))
}),
T.OA.n({
	cA: {
		RS: function() {},
		rS: function(t, i) {
			this._A._a(this.ZA, t),
			this._A.ua(null, i, this.sa()),
			this.EQ("animationend")
		},
		TS: function(t, i) {
			this._A._a(this.ZA, t),
			this._A.ua(null, i, this.sa()),
			this.EQ("animationend")
		},
		Qa: function(t, i) {
			this.qa(t, i)
		}
	},
	VA: {
		RS: function() {
			this.KE.Pw.className += " tdt-cluster-anim",
			this.kA++
		},
		rS: function(t, i) {
			var e, s = this.sa(),
			n = this.jA;
			this.ja = !0,
			this._A.uS(s, t, 0,
			function(o) {
				var h, r = o.pr,
				a = o.CO;
				for (s.contains(r) || (r = null), o.IS() && t + 1 === i ? (n.removeLayer(o), o.ua(null, i, s)) : (o.iS(), o.ua(r, i, s)), e = a.length - 1; e >= 0; e--) h = a[e],
				s.contains(h.pr) || n.removeLayer(h)
			}),
			this.OS(),
			this._A.oS(s, i),
			n.ME(function(t) {
				t instanceof T.vA || !t.Gr || t.Ra()
			}),
			this._A.uS(s, t, i,
			function(t) {
				t.PS(i)
			}),
			this.ja = !1,
			this.wS(function() {
				this._A.uS(s, t, 0,
				function(t) {
					n.removeLayer(t),
					t.Ra()
				}),
				this.pS()
			})
		},
		TS: function(t, i) {
			this.AS(this._A, t - 1, i),
			this._A.ua(null, i, this.sa()),
			this._A._a(this.ZA, t, this.sa())
		},
		Qa: function(t, i) {
			var e = this,
			s = this.jA;
			s.addLayer(t),
			i !== t && (i.ka > 2 ? (i.Ua(), this.OS(), this.RS(), t.gr(this.KE.Lw(i.pE())), t.iS(), this.wS(function() {
				s.removeLayer(t),
				t.Ra(),
				e.pS()
			})) : (this.OS(), e.RS(), e.AS(i, this.KE.getMaxZoom(), this.KE.getZoom())))
		}
	},
	AS: function(t, i, e) {
		var s = this.sa();
		t.aS(s, i + 1, e);
		var n = this;
		this.OS(),
		t.oS(s, e),
		this.wS(function() {
			if (1 === t.ka) {
				var o = t.CO[0];
				this.ja = !0,
				o.dr(o.pE()),
				this.ja = !1,
				o.Ra && o.Ra()
			} else t.uS(s, e, 0,
			function(t) {
				t._a(s, i + 1)
			});
			n.pS()
		})
	},
	pS: function() {
		this.KE && (this.KE.Pw.className = this.KE.Pw.className.replace(" tdt-cluster-anim", "")),
		this.kA--,
		this.EQ("animationend")
	},
	OS: function() {
		T.s.h(document.body.offsetWidth)
	}
}),
T.SS = function(t) {
	return new T.OA(t)
},
T.vA = T.Marker.extend({
	initialize: function(t, i, e, s) {
		T.Marker.prototype.initialize.call(this, e ? e.la || e.pE() : new T.Fq(0, 0), {
			icon: this
		}),
		this.Pa = t,
		this.GW = i,
		this.CO = [],
		this.Ca = [],
		this.ka = 0,
		this.Ya = !0,
		this.La = !0,
		this.qr = new T.kq,
		e && this.WS(e),
		s && this.WS(s)
	},
	ta: function(t) {
		t = t || [];
		for (var i = this.Ca.length - 1; i >= 0; i--) this.Ca[i].ta(t);
		for (var e = this.CO.length - 1; e >= 0; e--) t.push(this.CO[e]);
		return t
	},
	Ta: function() {
		return this.ka
	},
	aa: function() {
		for (var t, i = this.Ca.slice(), e = this.Pa.KE, s = e._W(this.qr), n = this.GW + 1, o = e.getZoom(); i.length > 0 && s > n;) {
			n++;
			var h = [];
			for (t = 0; t < i.length; t++) h = h.concat(i[t].Ca);
			i = h
		}
		s > n ? this.Pa.KE.HW(this.pr, n) : s <= o ? this.Pa.KE.HW(this.pr, o + 1) : this.Pa.KE.mW(this.qr)
	},
	getBounds: function() {
		var t = new T.kq;
		return t.extend(this.qr),
		t
	},
	Ua: function() {
		this.Ya = !0,
		this.Gr && this.setIcon(this)
	},
	Tr: function() {
		return this.Ya && (this.sS = this.Pa.options.PA(this), this.Ya = !1),
		this.sS.Tr()
	},
	Yr: function() {
		return this.sS.Yr()
	},
	WS: function(t, i) {
		this.Ya = !0,
		this.La = !0,
		this.DS(t),
		t instanceof T.vA ? (i || (this.Ca.push(t), t.mA = this), this.ka += t.ka) : (i || this.CO.push(t), this.ka++),
		this.mA && this.mA.WS(t, !0)
	},
	DS: function(t) {
		this.fLatLng || (this.fLatLng = t.pr),
		this.la || (this.la = t.la || t.pr)
	},
	dS: function() {
		var t = this.qr;
		t.Lq && (t.Lq.lat = 1 / 0, t.Lq.lng = 1 / 0),
		t.lq && (t.lq.lat = -(1 / 0), t.lq.lng = -(1 / 0))
	},
	nA: function() {
		var t, i, e, s, n = this.CO,
		o = this.Ca,
		h = 0,
		r = 0,
		a = this.ka;
		if (0 !== a) {
			for (this.dS(), t = 0; t < n.length; t++) e = n[t].pr,
			this.qr.extend(e),
			h += e.lat,
			r += e.lng;
			for (t = 0; t < o.length; t++) i = o[t],
			i.La && i.nA(),
			this.qr.extend(i.qr),
			e = i.FS,
			s = i.ka,
			h += e.lat * s,
			r += e.lng * s;
			this.pr = this.FS = new T.Fq(h / a, r / a),
			this.La = !1
		}
	},
	US: function(t) {
		t && (this.fS = this.pr, this.dr(t)),
		this.Pa.jA.addLayer(this)
	},
	GS: function(t, i, e) {
		this.uS(t, 0, e - 1,
		function(t) {
			var e, s, n = t.CO;
			for (e = n.length - 1; e >= 0; e--) s = n[e],
			s.Gr && (s.gr(i), s.iS())
		},
		function(t) {
			var e, s, n = t.Ca;
			for (e = n.length - 1; e >= 0; e--) s = n[e],
			s.Gr && (s.gr(i), s.iS())
		})
	},
	aS: function(t, i, e) {
		this.uS(t, e, 0,
		function(s) {
			s.GS(t, s.Pa.KE.Lw(s.pE()).JQ(), i),
			s.IS() && i - 1 === e ? (s.Ra(), s._a(t, i)) : s.iS(),
			s.US()
		})
	},
	oS: function(t, i) {
		this.uS(t, 0, i, null,
		function(t) {
			t.Ra()
		})
	},
	ua: function(t, i, e) {
		this.uS(e, -1, i,
		function(s) {
			if (i !== s.GW) for (var n = s.CO.length - 1; n >= 0; n--) {
				var o = s.CO[n];
				e.contains(o.pr) && (t && (o.fS = o.pE(), o.dr(t), o.iS && o.iS()), s.Pa.jA.addLayer(o))
			}
		},
		function(i) {
			i.US(t)
		})
	},
	PS: function(t) {
		for (var i = this.CO.length - 1; i >= 0; i--) {
			var e = this.CO[i];
			e.fS && (e.dr(e.fS), delete e.fS)
		}
		if (t - 1 === this.GW) for (var s = this.Ca.length - 1; s >= 0; s--) this.Ca[s].gS();
		else for (var n = this.Ca.length - 1; n >= 0; n--) this.Ca[n].PS(t)
	},
	gS: function() {
		this.fS && (this.dr(this.fS), delete this.fS)
	},
	_a: function(t, i, e) {
		var s, n;
		this.uS(t, -1, i - 1,
		function(t) {
			for (n = t.CO.length - 1; n >= 0; n--) s = t.CO[n],
			e && e.contains(s.pr) || (t.Pa.jA.removeLayer(s), s.Ra && s.Ra())
		},
		function(t) {
			for (n = t.Ca.length - 1; n >= 0; n--) s = t.Ca[n],
			e && e.contains(s.pr) || (t.Pa.jA.removeLayer(s), s.Ra && s.Ra())
		})
	},
	uS: function(t, i, e, s, n) {
		var o, h, r = this.Ca,
		a = this.GW;
		if (i > a) for (o = r.length - 1; o >= 0; o--) h = r[o],
		t.intersects(h.qr) && h.uS(t, i, e, s, n);
		else if (s && s(this), n && this.GW === e && n(this), e > a) for (o = r.length - 1; o >= 0; o--) h = r[o],
		t.intersects(h.qr) && h.uS(t, i, e, s, n)
	},
	IS: function() {
		return this.Ca.length > 0 && this.Ca[0].ka === this.ka
	}
}),
T.Marker.n({
	iS: function() {
		return this.options.HS = this.options.opacity || 1,
		this.setOpacity(0)
	},
	Ra: function() {
		var t = this.setOpacity(this.options.opacity || this.options.HS);
		return delete this.options.HS,
		t
	}
}),
T.ma = function(t) {
	this.hS = t,
	this.JS = t * t,
	this.jS = {},
	this.KS = {}
},
T.ma.prototype = {
	Za: function(t, i) {
		var e = this.kS(i.x),
		s = this.kS(i.y),
		n = this.jS,
		o = n[s] = n[s] || {},
		h = o[e] = o[e] || [],
		r = T.s.F(t);
		this.KS[r] = i,
		h.push(t)
	},
	LS: function(t, i) {
		this.Ja(t),
		this.Za(t, i)
	},
	Ja: function(t, i) {
		var e, s, n = this.kS(i.x),
		o = this.kS(i.y),
		h = this.jS,
		r = h[o] = h[o] || {},
		a = r[n] = r[n] || [];
		for (delete this.KS[T.s.F(t)], e = 0, s = a.length; e < s; e++) if (a[e] === t) return a.splice(e, 1),
		1 === s && delete r[n],
		!0
	},
	lS: function(t, i) {
		var e, s, n, o, h, r, a, u = this.jS;
		for (e in u) {
			h = u[e];
			for (s in h) for (r = h[s], n = 0, o = r.length; n < o; n++) a = t.call(i, r[n]),
			a && (n--, o--)
		}
	},
	qS: function(t) {
		var i, e, s, n, o, h, r, a, u = this.kS(t.x),
		l = this.kS(t.y),
		c = this.KS,
		f = this.JS,
		p = null;
		for (i = l - 1; i <= l + 1; i++) if (n = this.jS[i]) for (e = u - 1; e <= u + 1; e++) if (o = n[e]) for (s = 0, h = o.length; s < h; s++) r = o[s],
		a = this.Dt(c[T.s.F(r)], t),
		a < f && (f = a, p = r);
		return p
	},
	kS: function(t) {
		return Math.floor(t / this.hS)
	},
	Dt: function(t, i) {
		var e = i.x - t.x,
		s = i.y - t.y;
		return e * e + s * s
	}
},
function() {
	T.ZS = {
		getDistant: function(t, i) {
			var e = i[1].lat - i[0].lat,
			s = i[0].lng - i[1].lng;
			return s * (t.lat - i[0].lat) + e * (t.lng - i[0].lng)
		},
		CS: function(t, i) {
			var e, s, n, o = 0,
			h = null,
			r = [];
			for (e = i.length - 1; e >= 0; e--) s = i[e],
			n = this.getDistant(s, t),
			n > 0 && (r.push(s), n > o && (o = n, h = s));
			return {
				maxPoint: h,
				newPoints: r
			}
		},
		VS: function(t, i) {
			var e = [],
			s = this.CS(t, i);
			return s.maxPoint ? (e = e.concat(this.VS([t[0], s.maxPoint], s.newPoints)), e = e.concat(this.VS([s.maxPoint, t[1]], s.newPoints))) : [t[0]]
		},
		Ma: function(t) {
			var i, e = !1,
			s = !1,
			n = !1,
			o = !1,
			h = null,
			r = null,
			a = null,
			u = null,
			l = null,
			c = null;
			for (i = t.length - 1; i >= 0; i--) {
				var f = t[i]; (e === !1 || f.lat > e) && (h = f, e = f.lat),
				(s === !1 || f.lat < s) && (r = f, s = f.lat),
				(n === !1 || f.lng > n) && (a = f, n = f.lng),
				(o === !1 || f.lng < o) && (u = f, o = f.lng)
			}
			s !== e ? (c = r, l = h) : (c = u, l = a);
			var p = [].concat(this.VS([c, l], t), this.VS([l, c], t));
			return p
		}
	}
} (),
T.vA.n({
	Ma: function() {
		var t, i, e = this.ta(),
		s = [];
		for (i = e.length - 1; i >= 0; i--) t = e[i].pE(),
		s.push(t);
		return T.ZS.Ma(s)
	}
}),
T.vA.n({
	cS: 2 * Math.PI,
	BS: 25,
	vS: Math.PI / 6,
	NS: 28,
	bS: 11,
	MS: 5,
	nS: 9,
	Aa: function() {
		if (this.Pa.ba !== this && !this.Pa.kA) {
			var t, i = this.ta(),
			e = this.Pa,
			s = e.KE,
			n = s.Lw(this.pr);
			this.Pa.bA(),
			this.Pa.ba = this,
			i.length >= this.nS ? t = this._S(i.length, n) : (n.y += 10, t = this.mS(i.length, n)),
			this.Qs(i, t)
		}
	},
	qs: function(t) {
		this.Pa.kA || (this.Ws(t), this.Pa.ba = null)
	},
	mS: function(t, i) {
		var e, s, n = this.Pa.options.FA * this.BS * (2 + t),
		o = n / this.cS,
		h = this.cS / t,
		r = [];
		for (r.length = t, e = t - 1; e >= 0; e--) s = this.vS + e * h,
		r[e] = new T.Point(i.x + o * Math.cos(s), i.y + o * Math.sin(s)).jQ();
		return r
	},
	_S: function(t, i) {
		var e, s = this.Pa.options.FA,
		n = s * this.bS,
		o = s * this.NS,
		h = s * this.MS * this.cS,
		r = 0,
		a = [];
		for (a.length = t, e = t - 1; e >= 0; e--) r += o / n + 5e-4 * e,
		a[e] = new T.Point(i.x + n * Math.cos(r), i.y + n * Math.sin(r)).jQ(),
		n += h / r;
		return a
	},
	Oa: function() {
		var t, i, e = this.Pa,
		s = e.KE,
		n = e.jA,
		o = this.ta();
		for (e.ja = !0, this.setOpacity(1), i = o.length - 1; i >= 0; i--) t = o[i],
		n.removeLayer(t),
		t.ws && (t.dr(t.ws), delete t.ws),
		t.setZIndexOffset && t.setZIndexOffset(0),
		t.Es && (s.removeLayer(t.Es), delete t.Es);
		e.EQ("es", {
			cluster: this,
			markers: o
		}),
		e.ja = !1,
		e.ba = null
	}
}),
T.NA = T.vA.extend({
	Qs: function(t, i) {
		var e, s, n, o, h = this.Pa,
		r = h.KE,
		a = h.jA,
		u = this.Pa.options.fA;
		for (h.ja = !0, e = 0; e < t.length; e++) o = r.dw(i[e]),
		s = t[e],
		n = new T.Polyline([this.pr, o], u),
		r.addLayer(n),
		s.Es = n,
		s.ws = s.pr,
		s.dr(o),
		s.setZIndexOffset && s.setZIndexOffset(1e6),
		a.addLayer(s);
		this.setOpacity(.3),
		h.ja = !1,
		h.EQ("spiderfied", {
			cluster: this,
			markers: t
		})
	},
	Ws: function() {
		this.Oa()
	}
}),
T.vA.n({
	Qs: function(t, i) {
		var e, s, n, o, h, r, a = this,
		u = this.Pa,
		l = u.KE,
		c = u.jA,
		f = this.pr,
		p = l.Lw(f),
		d = T.LT.SVG,
		m = T.extend({},
		this.Pa.options.fA),
		y = m.opacity;
		for (void 0 === y && (y = T.OA.prototype.options.fA.opacity), d ? (m.opacity = 0, m.className = (m.className || "") + " tdt-cluster-spider-leg") : m.opacity = y, u.ja = !0, e = 0; e < t.length; e++) s = t[e],
		r = l.dw(i[e]),
		n = new T.Polyline([f, r], m),
		l.addLayer(n),
		s.Es = n,
		d && (o = n.It, h = o.getTotalLength() + .1, o.style.strokeDasharray = h, o.style.strokeDashoffset = h),
		s.setZIndexOffset && s.setZIndexOffset(1e6),
		s.iS && s.iS(),
		c.addLayer(s),
		s.gr && s.gr(p);
		for (u.OS(), u.RS(), e = t.length - 1; e >= 0; e--) r = l.dw(i[e]),
		s = t[e],
		s.ws = s.pr,
		s.dr(r),
		s.Ra && s.Ra(),
		d && (n = s.Es, o = n.It, o.style.strokeDashoffset = 0, n.er({
			opacity: y
		}));
		this.setOpacity(.3),
		u.ja = !1,
		setTimeout(function() {
			u.pS(),
			u.EQ("spiderfied", {
				cluster: a,
				markers: t
			})
		},
		200)
	},
	Ws: function(t) {
		var i, e, s, n, o, h, r = this,
		a = this.Pa,
		u = a.KE,
		l = a.jA,
		c = t ? u.dE(this.pr, t.zoom, t.center) : u.Lw(this.pr),
		f = this.ta(),
		p = T.LT.SVG;
		for (a.ja = !0, a.RS(), this.setOpacity(1), e = f.length - 1; e >= 0; e--) i = f[e],
		i.ws && (i.dr(i.ws), delete i.ws, h = !0, i.gr && (i.gr(c), h = !1), i.iS && (i.iS(), h = !1), h && l.removeLayer(i), p && (s = i.Es, n = s.It, o = n.getTotalLength() + .1, n.style.strokeDashoffset = o, s.er({
			opacity: 0
		})));
		a.ja = !1,
		setTimeout(function() {
			var t = 0;
			for (e = f.length - 1; e >= 0; e--) i = f[e],
			i.Es && t++;
			for (e = f.length - 1; e >= 0; e--) i = f[e],
			i.Es && (i.Ra && i.Ra(), i.setZIndexOffset && i.setZIndexOffset(0), t > 1 && l.removeLayer(i), u.removeLayer(i.Es), delete i.Es);
			a.pS(),
			a.EQ("es", {
				cluster: r,
				markers: f
			})
		},
		200)
	}
}),
T.OA.n({
	ba: null,
	qs: function() {
		this.bA.apply(this, arguments)
	},
	da: function() {
		this.KE.on("click", this.Rs, this),
		this.KE.options.Mr && this.KE.on("zoomstart", this.rs, this),
		this.KE.on("zoomend", this.Oa, this),
		T.PQ.touch || this.KE.MT(this)
	},
	Ga: function() {
		this.KE.off("click", this.Rs, this),
		this.KE.off("zoomstart", this.rs, this),
		this.KE.off("ge", this.Ts, this),
		this.KE.off("zoomend", this.Oa, this),
		this.Oa()
	},
	rs: function() {
		this.KE && this.KE.on("ge", this.Ts, this)
	},
	Ts: function(t) {
		T.mQ.eq(this.KE.Pw, "tdt-touching") || (this.KE.off("ge", this.Ts, this), this.bA(t))
	},
	Rs: function() {
		this.bA()
	},
	bA: function(t) {
		this.ba && this.ba.qs(t)
	},
	Oa: function() {
		this.ba && this.ba.Oa()
	},
	wa: function(t) {
		t.Es && (this.jA.removeLayer(t), t.Ra && t.Ra(), t.setZIndexOffset && t.setZIndexOffset(0), this.KE.removeLayer(t.Es), delete t.Es)
	}
}),
T.OA.n({
	ts: function(t) {
		return t ? t instanceof T.OA ? t = t._A.ta() : t instanceof T.LayerGroup ? t = t.JW: t instanceof T.vA ? t = t.ta() : t instanceof T.Marker && (t = [t]) : t = this._A.ta(),
		this.Ys(t),
		this.Us(),
		this.options.SA && this.us(t),
		this
	},
	Ys: function(t) {
		var i, e;
		for (i in t) for (e = t[i].mA; e;) e.Ya = !0,
		e = e.mA
	},
	Us: function() {
		this.jA.ME(function(t) {
			t instanceof T.vA && t.Ya && t.Ua()
		})
	},
	us: function(t) {
		var i, e;
		for (i in t) e = t[i],
		this.hasLayer(e) && e.setIcon(this.QS(e))
	}
}),
T.Marker.n({
	Is: function(t, i) {
		var e = this.options.icon;
		return T.setOptions(e, t),
		this.setIcon(e),
		i && this.mA && this.mA.Pa.ts(this),
		this
	}
}),
T.is = T.DivIcon.extend({
	options: {
		url: "",
		size: [12, 12],
		offset: [],
		textColor: "#ff00ff",
		textSize: 10
	},
	initialize: function(t) {
		t && (t.bgPos && (this.options.bgPos = t.offset), t.size && (this.options.iconSize = t.size), t.textColor && (this.options.textColor = t.textColor), t.textSize && (this.options.textSize = t.textSize), t.url && (this.options.url = t.url)),
		this.options.className = "tdt-cluster0",
		T.DivIcon.prototype.initialize.call(this, t)
	},
	rr: function(t, i) {
		T.DivIcon.prototype.rr.call(this, t, i),
		t.className = this.options.className || "",
		this.options.url && (t.style.backgroundImage = "url(" + this.options.url + ")"),
		this.options.textColor && (t.style.color = this.options.textColor),
		this.options.textSize && (t.style.fontSize = this.options.textSize + "pt"),
		t.style.lineHeight = t.style.height
	}
}),
T.MarkerClusterer = T.OA.extend({
	options: {
		markers: {},
		girdSize: 60,
		maxZoom: 30,
		minClusterSize: 2,
		isAverangeCenter: !1,
		styles: [{
			url: "http://api.tianditu.com/img/map/cluster/cluster0.png",
			size: [42, 42],
			offset: new T.Point( - 15, -13),
			textColor: "#ffffff",
			textSize: 8,
			range: [0, 200]
		},
		{
			url: "http://api.tianditu.com/img/map/cluster/cluster1.png",
			size: [42, 42],
			offset: new T.Point( - 20, -17),
			textColor: "#ffffff",
			textSize: 10,
			range: [200, 500]
		},
		{
			url: "http://api.tianditu.com/img/map/cluster/cluster3.png",
			size: [50, 50],
			soffset: new T.Point( - 10, -22),
			textColor: "#ffffff",
			textSize: 10,
			range: [500, 1e3]
		},
		{
			url: "http://api.tianditu.com/img/map/cluster/cluster4.png",
			size: [55, 55],
			soffset: new T.Point( - 10, -22),
			textColor: "#ffffff",
			textSize: 10,
			range: [1e3]
		}]
	},
	initialize: function(t, i) {
		T.s.setOptions(this, i),
		i && i.minClusterSize && (this.options.styles = i.styles),
		T.OA.prototype.initialize.call(this, i),
		i.markers && this.addLayers(i.markers),
		this.options.AA = !1,
		t.addLayer(this),
		t.on("zoomend moveend", this._viewChangeEndNotClustering, this)
	},
	_viewChangeEndNotClustering: function() {
		var t = this.jA,
		i = this.sa(),
		e = this.options.minClusterSize,
		s = this.options.isAverangeCenter;
		targetZoom = this.GW,
		t.ME(function(i) {
			t.removeLayer(i)
		}),
		this._A.uS(i, -1, targetZoom,
		function(i) {
			if (i.GW !== targetZoom) for (var e, s = i.CO,
			n = 0; n < s.length; n++) e = i.CO[n],
			t.addLayer(e)
		},
		function(i) {
			if (s ? i.dr(i.getBounds().getCenter()) : i.dr(i.fLatLng), i.ka < e) for (var n = i.ta(), o = 0; o < n.length; o++) t.addLayer(n[o]);
			else i.US()
		})
	},
	addMarker: function(t) {
		return this.addLayer(t),
		this
	},
	addMarkers: function(t) {
		return this.addLayers(t),
		this
	},
	clearMarkers: function() {
		return this.clearLayers(),
		this
	},
	getClustersCount: function() {
		return markers && markers.jA && markers.jA.getLayers() ? markers.jA.getLayers().length: 0
	},
	getGridSize: function() {
		return this.options.oA
	},
	getMarkers: function() {
		return markers.jA.getLayers()
	},
	getMaxZoom: function() {
		return this.options.sA
	},
	getStyles: function() {
		return this.options.styles
	},
	isAverageCenter: function() {},
	removeMarker: function(t) {
		return this.removeLayer(t),
		this
	},
	removeMarkers: function(t) {
		return this.removeLayers(t),
		this
	},
	setGridSize: function(t) {
		this.options.oA = t;
		var i = this.getLayers().splice(0);
		return this.clearMarkers(),
		this.addMarkers(i),
		this
	},
	setMaxZoom: function(t) {
		this.options.sA = t;
		var i = this.getLayers().splice(0);
		return this.clearMarkers(),
		this.addMarkers(i),
		this
	},
	setMinClusterSize: function(t) {},
	setStyles: function(t, i) {
		this.options.styles = t,
		t && (this.options.PA = function(i) {
			var e = {};
			for (e.childCount = childCount = i.Ta(), k = 0; k < t.length; k++) {
				var s = t[k];
				if (2 == s.range.length && s.range[0] <= childCount && childCount <= s.range[1]) {
					e = s,
					e.childCount = childCount,
					e.iconSize = s.size;
					break
				}
				if (1 == s.range.length && childCount > s.range[0]) {
					e = s,
					e.childCount = childCount,
					e.iconSize = s.size;
					break
				}
			}
			var n = "<div><span >" + childCount + "</span></div>";
			return e.html = n,
			new T.is(e)
		},
		i || this.ts())
	}
}),
T.Map.ContextMenu = T.Lr.extend({
	Uu: T.PQ.msPointer ? "MSPointerDown": T.PQ.pointer ? "pointerdown": "touchstart",
	N: {
		Os: "tdt-contextmenu"
	},
	initialize: function(t) {
		T.Lr.prototype.initialize.call(this, t),
		this.os || (this.os = []),
		this.Ps = !1;
		var i = this.ow = T.mQ.D("div", T.Map.ContextMenu.Os, t.ow);
		i.style.zIndex = 1e4,
		i.style.position = "absolute",
		t.options.ps && (i.style.width = t.options.ps + "px"),
		this.As(),
		T.Pq.on(i, "click", T.Pq.Iw).on(i, "mousedown", T.Pq.Iw).on(i, "dblclick", T.Pq.Iw).on(i, "contextmenu", T.Pq.Iw)
	},
	AU: function() {
		T.Pq.on(document, "keydown", this.wI, this),
		this.KE.on({
			contextmenu: this.as,
			mousedown: this.Ss,
			movestart: this.Ss,
			zoomstart: this.Ss
		},
		this),
		T.Pq.on(this.KE.getContainer(), "mouseleave", this.Ss, this)
	},
	Sr: function() {
		T.Pq.off(document, "keydown", this.wI, this),
		this.KE.off({
			contextmenu: this.as,
			mousedown: this.Ss,
			movestart: this.Ss,
			zoomstart: this.Ss
		},
		this),
		T.Pq.off(this.KE.getContainer(), "mouseleave", this.Ss, this)
	},
	ss: function(t, i) {
		t instanceof T.Fq && (t = this.KE.vW(t)),
		this.Ds(t, i)
	},
	hide: function() {
		this.Ss()
	},
	addItem: function(t) {
		if (this.ow) this.ds(t);
		else if ("-" != t) {
			var i = new T.MenuItem(t.text, t.callback);
			i.Fs = 0,
			this.fs || (this.fs = []),
			this.fs.push(i)
		} else this.fs.push(t)
	},
	ds: function(t, i) {
		this.os || (this.os = []),
		i = void 0 !== i ? i: this.os.length;
		var e = this.Gs(this.ow, t, i);
		return this.os.push(e),
		this.LW = !0,
		this.KE.EQ("contextmenu.additem", {
			contextmenu: this,
			el: e.el,
			index: i
		}),
		e.el
	},
	removeItem: function(t) {
		var i = this.ow;
		isNaN(t) || (t = i.children[t]),
		t && (this.gs(T.s.F(t)), this.LW = !0, this.KE.EQ("contextmenu.removeitem", {
			contextmenu: this,
			el: t
		}))
	},
	Hs: function() {
		for (var t; this.ow.children.length;) t = this.ow.children[0],
		this.gs(T.s.F(t))
	},
	hs: function() {
		var t, i, e;
		for (i = 0, e = this.os.length; i < e; i++) t = this.os[i],
		t.el.style.display = "none"
	},
	Js: function() {
		var t, i, e;
		for (i = 0, e = this.os.length; i < e; i++) t = this.os[i],
		t.el.style.display = ""
	},
	js: function(t, i) {
		var e = this.ow,
		s = T.Map.ContextMenu.Os + "-item";
		isNaN(t) || (t = e.children[t]),
		t && T.mQ.eq(t, s) && (i ? (T.mQ.rq(t, s + "-disabled"), this.KE.EQ("contextmenu.disableitem", {
			contextmenu: this,
			el: t
		})) : (T.mQ.tq(t, s + "-disabled"), this.KE.EQ("contextmenu.enableitem", {
			contextmenu: this,
			el: t
		})))
	},
	Ks: function() {
		return this.Ps
	},
	As: function() {
		this.fs || (this.fs = []);
		var t, i, e = this.fs;
		for (t = 0, i = e.length; t < i; t++) this.os.push(this.Gs(this.ow, e[t]))
	},
	Gs: function(t, i, e) {
		var s = new T.MenuItem;
		if (s.text = i.text, i.separator || "-" === i) return this.ks(t, e);
		var n = T.Map.ContextMenu.Os + "-item",
		o = i.disabled ? n + " " + n + "-disabled": n,
		h = this.Ls("a", o, t, e),
		r = this.ls(h, i.callback, i.context, i.Zs),
		a = "";
		return i.icon ? a = "<img class='" + T.Map.ContextMenu.Os + "-icon' src='" + i.icon + "'/>": i.Cs && (a = "<span class='" + T.Map.ContextMenu.Os + "-icon " + i.Cs + "'></span>"),
		h.innerHTML = a + s.text,
		h.href = "#",
		s.el = h,
		T.Pq.on(h, "mouseover", this.Vs, this.el).on(h, "mouseout", this.cs, this.el).on(h, "mousedown", T.Pq.stopPropagation).on(h, "click", r),
		s.id = T.s.F(h),
		s.callback = r,
		s.Fs = 0,
		s.Bs(i.isable),
		s
	},
	gs: function(t) {
		var i, e, s, n;
		for (s = 0, n = this.os.length; s < n; s++) if (i = this.os[s], i.id === t) return e = i.el,
		callback = i.callback,
		callback && T.Pq.off(e, "mouseover", this.Vs, this).off(e, "mouseover", this.cs, this).off(e, "mousedown", T.Pq.stopPropagation).off(e, "click", i.callback),
		this.ow.removeChild(e),
		this.os.splice(s, 1),
		i;
		return null
	},
	ks: function(t, i) {
		var e = new T.MenuItem,
		s = this.Ls("div", T.Map.ContextMenu.Os + "-separator", t, i);
		return e.el = s,
		e.id = T.s.F(s),
		e.text = "-",
		e.Fs = 1,
		e
	},
	ls: function(t, i, e, s) {
		var n = this,
		o = this.KE,
		h = T.Map.ContextMenu.Os + "-item-disabled",
		s = void 0 === s || s;
		return function(r) {
			T.mQ.eq(t, h) || (s && n.Ss(), i && i.call(e || o, n.vs.lnglat), n.KE.EQ("contextmenu:select", {
				contextmenu: n,
				el: t
			}))
		}
	},
	Ls: function(t, i, e, s) {
		var n, o = document.createElement(t);
		return o.className = i,
		void 0 !== s && (n = e.children[s]),
		n ? e.insertBefore(o, n) : e.appendChild(o),
		o
	},
	as: function(t) {
		this.Ds(t.containerPoint)
	},
	Ds: function(t, i) {
		if (this.os.length) {
			for (var e = this.KE,
			s = e.lw(t), n = e.layerPointToLngLat(s), o = {
				contextmenu: this
			},
			h = 0; h < this.os.length; h++) this.os[h].Ns = n;
			i && (o = T.extend(i, o)),
			this.vs = {
				lnglat: n
			},
			this._P(t),
			this.Ps ? this._P(t) : (this.ow.style.display = "block", this.Ps = !0),
			this.KE.EQ("contextmenu.show", o)
		}
	},
	Ss: function() {
		this.Ps && (this.Ps = !1, this.ow.style.display = "none", this.KE.EQ("contextmenu.hide", {
			contextmenu: this
		}))
	},
	_P: function(t) {
		var i, e = this.KE.getSize(),
		s = this.ow,
		n = this.bs(s);
		this.KE.options.Ms && (i = T.sQ(this.KE.options.Ms), t = t.aQ(i)),
		s._tdt_pos = t,
		t.x + n.x > e.x ? (s.style.left = "auto", s.style.right = Math.max(e.x - t.x, 0) + "px") : (s.style.left = Math.max(t.x, 0) + "px", s.style.right = "auto"),
		t.y + n.y > e.y ? (s.style.top = "auto", s.style.bottom = Math.max(e.y - t.y, 0) + "px") : (s.style.top = Math.max(t.y, 0) + "px", s.style.bottom = "auto")
	},
	bs: function(t) {
		var i = this.hw,
		e = t.style.display;
		return i && !this.LW || (i = {},
		t.style.left = "-999999px", t.style.right = "auto", t.style.display = "block", i.x = t.offsetWidth, i.y = t.offsetHeight, t.style.left = "auto", t.style.display = e, this.LW = !1),
		i
	},
	QI: function(t) {
		this.Ss()
	},
	wI: function(t) {
		var i = t.keyCode;
		27 === i && this.Ss()
	},
	Vs: function(t) {
		T.mQ.rq(t.target || t.srcElement, "over")
	},
	cs: function(t) {
		T.mQ.tq(t.target || t.srcElement, "over")
	}
}),
T.MenuItem = T.B.extend({
	initialize: function(t, i, e) {
		this.text = t,
		this.callback = i,
		e && (this.weight = e.weight, this.icon = e.icon),
		this.Fs = 0,
		this.isable = !0
	},
	setText: function(t) {
		if (1 != this.Fs) return this.text = t,
		this.el && (this.el.innerHTML = this.text, T.mQ.rq(this.el, "tdt-contextmenu-item"), T.Pq.on(this.el, "mouseover", this.Vs, this.el).on(this.el, "mouseout", this.cs, this.el)),
		this
	},
	Vs: function(t) {
		T.mQ.rq(this, "over")
	},
	cs: function(t) {
		T.mQ.tq(this, "over")
	},
	setCallback: function(t) {
		return this.el && (this.callback && T.Pq.off(this.el, "click", this.callback), this.callback = this.ls(this.el, t), T.Pq.on(this.el, "click", this.callback, this)),
		this.callback = t,
		this
	},
	ls: function(t, i) {
		return function() {
			this.Ns && i(this.Ns)
		}
	},
	enable: function() {
		return this.isable = !0,
		this.Bs(this.isable),
		this
	},
	disable: function() {
		return this.isable = !1,
		this.Bs(this.isable),
		this
	},
	setIcon: function(t) {
		var t;
		return this.el && (t && (html = "<img class='" + T.Map.ContextMenu.Os + "-icon' src='" + t + "'/>"), this.el.innerHTML = html + this.text),
		this
	},
	Bs: function(t) {
		var i = T.Map.ContextMenu.Os + "-item",
		e = this.el;
		e && e && T.mQ.eq(e, i) && (t ? T.mQ.tq(e, i + "-disabled") : T.mQ.rq(e, i + "-disabled"))
	}
}),
T.ContextMenu = T.Map.ContextMenu.extend({
	includes: T.OQ.oQ,
	options: {
		width: 120,
		Items: []
	},
	initialize: function(t, i) {
		t.width && (this.options.width = t.width),
		t.Items && (this.options.Items = t.Items),
		i && this.ns(i, this.options)
	},
	Ds: function(t, i) {
		T.Map.ContextMenu.prototype.Ds.call(this, t, i),
		this.os.length && this.EQ("open", {
			pixel: t
		})
	},
	Ss: function() {
		T.Map.ContextMenu.prototype.Ss.call(this),
		this.Ps && this.EQ("close")
	},
	ns: function(t, i) {
		t.options.contextmenu = !0,
		t.options.ps = this.options.width,
		t.options.fs = this.options.Items,
		T.Map.ContextMenu.prototype.initialize.call(this, t),
		this.os = this.getItems(),
		this.enable()
	},
	getItem: function(t) {
		var i = this.getItems();
		return i[t]
	},
	removeItem: function(t) {
		t.hasOwnProperty("el") ? T.Map.ContextMenu.prototype.removeItem.call(this, t.el) : T.Map.ContextMenu.prototype.removeItem.call(this, t)
	},
	addSeparator: function() {
		this.addItem("-")
	},
	removeSeparator: function(t) {
		for (var i = 0,
		e = 0; this.os[i];) 1 == this.os[i].Fs && (e == t && this.removeItem(i), e++),
		i++
	},
	getItems: function() {
		var t;
		t = this.os ? this.os: this.fs;
		var i = [];
		if (this.os) for (index = 0; index < t.length; index++) 0 == this.os[index].Fs && (t[index].text = t[index].el.text, i.push(t[index])),
		1 == this.os[index].Fs && (t[index].text = "-");
		else i = t;
		return i
	},
	getAllSeparator: function() {
		var t = this.os,
		i = new Array;
		for (index = 0; index < t.length; index++) 1 == this.os[index].Fs && i.push(t[index]);
		return i
	}
}),
T.Map.n({
	addContextMenu: function(t, i) {
		t.ns(this, i)
	}
}),
T.CoordinatePickup = T.Lr.extend({
	options: {},
	initialize: function(t, i) {
		this.KE = t,
		i && i.callback && (this.callback = i.callback)
	},
	AU: function() {
		this.KE.on("click", this._onEvent, this)
	},
	Sr: function() {
		this.KE.off("click", this._onEvent, this)
	},
	_onEvent: function(t) {
		var i = t.lnglat;
		this.callback(i)
	},
	enable: function() {
		this.KE && this.callback && (this.TU || T.Lr.prototype.enable.call(this))
	},
	disable: function() {
		this.TU && T.Lr.prototype.disable.call(this)
	},
	addEvent: function() {
		this.enable()
	},
	removeEvent: function() {
		this.disable()
	}
}),
window.TDT_POINT_SIZE_TINY = "TINY",
window.TDT_POINT_SIZE_SMALLER = "SMALLER",
window.TDT_POINT_SIZE_SMALL = "SMALL",
window.TDT_POINT_SIZE_NORMAL = "NORMAL",
window.TDT_POINT_SIZE_BIG = "BIG",
window.TDT_POINT_SIZE_BIGGER = "BIGGER",
window.TDT_POINT_SIZE_HUGE = "HUGE",
window.TDT_POINT_SHAPE_CIRCLE = "CIRCLE",
window.TDT_POINT_SHAPE_STAR = "STAR",
window.TDT_POINT_SHAPE_SQUARE = "SQUARE",
window.TDT_POINT_SHAPE_RHOMBUS = "RHOMBUS",
window.TDT_POINT_SHAPE_WATERDROP = "WATERDROP",
T.CloudMarker = T.LT.extend({
	options: {
		fill: !0,
		size: 1,
		weight: 0,
		fillOpacity: .6,
		shape: 0,
		zindex: 0
	},
	initialize: function(t, i) {
		T.setOptions(this, i),
		this.OW = new T.Wt,
		this.pr = T.Gq(t),
		this.hw = this.options.size
	},
	dr: function(t) {
		return this.pr = T.Gq(t),
		this.redraw(),
		this.EQ("move", {
			lT: this.pr
		})
	},
	pE: function() {
		return this.pr
	},
	er: function(t) {
		return T.setOptions(this, t),
		T.LT.prototype.er.call(this, t),
		this
	},
	tt: function() {
		this.TY = this.KE.Lw(this.pr),
		this.tY()
	},
	oe: function() {
		this.KE && this.Yt()
	},
	Yt: function() {
		0 == this.options.shape ? this._T._updatePaths(this, this._updatePath_circles) : 1 == this.options.shape ? this._T._updatePaths(this, this._updatePath_rects) : 2 == this.options.shape ? this._T._updatePaths(this, this._updatePath_diamonds) : 3 == this.options.shape ? this._T._updatePaths(this, this._updatePath_stars) : 4 == this.options.shape && this._T._updatePaths(this, this._updatePath_w)
	},
	_updatePath_rects: function(t, i, e) {
		t.beginPath(),
		t.moveTo(i.x - e / 2, i.y - e / 2),
		t.lineTo(i.x - e / 2, i.y + e / 2),
		t.lineTo(i.x + e / 2, i.y + e / 2),
		t.lineTo(i.x + e / 2, i.y - e / 2),
		t.closePath()
	},
	_updatePath_diamonds: function(t, i, e) {
		t.beginPath(),
		t.moveTo(i.x, i.y - e / 2),
		t.lineTo(i.x - e / 2, i.y),
		t.lineTo(i.x, i.y + e / 2),
		t.lineTo(i.x + e / 2, i.y),
		t.closePath()
	},
	_updatePath_circles: function(t, i, e) {
		t.beginPath(),
		t.arc(i.x, i.y, e / 2, 0, 2 * Math.PI, !1)
	},
	_updatePath_w: function(t, i, e) {
		t.beginPath(),
		e = e / 4 * 3;
		var s = i.x,
		n = i.y - e / 4,
		o = e / 2,
		h = e;
		t.moveTo(s, n - o),
		t.bezierCurveTo(s - o, n - o, s - 3 * o / 2, n + o / 3, s, n + h),
		t.bezierCurveTo(s + 3 * o / 2, n + o / 3, s + o, n - o, s, n - o),
		t.closePath()
	},
	_updatePath_stars: function(context, p, l) {
		var x = p.x,
		y = p.y - l / 8;
		l = 3 * l / 8;
		var rad1 = Math.sin(.4 * Math.PI),
		rad2 = Math.cos(.4 * Math.PI),
		rad3 = Math.sin(.2 * Math.PI),
		rad4 = Math.cos(.2 * Math.PI);
		with(context) context.beginPath(),
		context.moveTo(x + 0, y - l * rad1),
		context.lineTo(x + l * rad2, y + 0),
		context.lineTo(x + l + l * rad2, y + 0),
		context.lineTo(x + l * rad2 + 2 * l * rad2 * rad2, y + l * rad3),
		context.lineTo(x + l * rad4, y + 2 * l * rad1 * rad1 - l * rad1 + l * rad3),
		context.lineTo(x + 0, y + 2 * l * rad1 * rad1 - l * rad1),
		context.lineTo(x - l * rad4, y + 2 * l * rad1 * rad1 - l * rad1 + l * rad3),
		context.lineTo(x - l * rad2 - 2 * l * rad2 * rad2, y + l * rad3),
		context.lineTo(x + -l - l * rad2, y + 0),
		context.lineTo(x - l * rad2, y + 0),
		context.lineTo(x + 0, y - l * rad1),
		context.closePath()
	},
	uY: function() {
		return this.hw && !this._T.qr.intersects(this.Mt)
	},
	tY: function() {
		var t = this.hw,
		i = this.YY || t,
		e = this.it(),
		s = [t + e, i + e];
		this.Mt = new T.CQ(this.TY.DQ(s), this.TY.aQ(s))
	},
	uY: function() {
		return this.hw && !this._T.qr.intersects(this.Mt)
	}
}),
T.CloudMarker.prototype.jY = function(t) {
	if (0 == this.options.shape) return t.distanceTo(this.TY) <= this.options.size / 2;
	var i = this.TY,
	e = this.options.size,
	s = t.y + e / 2,
	n = t.y - e / 2,
	o = t.x + e / 2,
	h = t.x - e / 2;
	return n <= i.y && i.y <= s && h <= i.x && i.x <= o
},
T.CloudMarkerCollection = T.HT.extend({
	options: {
		fill: !0,
		size: 10,
		color: "#fa937e",
		fillOpacity: .6,
		shape: 0
	},
	initialize: function(t, i) {
		this.latlngs = t ? t: [],
		T.setOptions(this, i),
		this.checkedOption(),
		T.LayerGroup.prototype.initialize.call(this, i),
		this.options.OW = this.options.OW ? this.options.OW: new T.CanvasMarker;
		for (var e = 0; e < t.length; e++) this.addLayer(new T.CloudMarker(t[e], this.options));
		return this
	},
	checkedOption: function() {
		switch (this.options.ShapeType) {
		case "CIRCLE":
			this.options.shape = 0;
			break;
		case "STAR":
			this.options.shape = 1;
			break;
		case "SQUARE":
			this.options.shape = 2;
			break;
		case "RHOMBUS":
			this.options.shape = 3;
			break;
		case "WATERDROP":
			this.options.shape = 4
		}
		switch (this.options.SizeType) {
		case "TINY":
			this.options.size = 2;
			break;
		case "SMALLER":
			this.options.size = 4;
			break;
		case "SMALL":
			this.options.size = 8;
			break;
		case "NORMAL":
			this.options.size = 10;
			break;
		case "BIG":
			this.options.size = 16;
			break;
		case "BIGGER":
			this.options.size = 20;
			break;
		case "HUGE":
			this.options.size = 30
		}
	},
	setLnglats: function(t) {
		this.latlngs = t,
		this.clear();
		for (var i = 0; i < this.latlngs.length; i++) this.addLayer(new T.CloudMarker(this.latlngs[i], this.options))
	},
	setStyles: function(t) {
		T.setOptions(this, t),
		this.setPoints(this.latlngs)
	},
	clear: function() {
		this.clearLayers()
	}
}),
T.CanvasMarker = T.Wt.extend({
	DW: function() {
		var t = this.ow = document.createElement("canvas");
		T.Pq.on(t, "mousemove", T.s.g(this.aY, 32, this), this).on(t, "click", this.SY, this).on(t, "mouseout", this.sY, this),
		this.DY = t.getContext("2d")
	},
	_updatePaths: function(t, i) {
		if (!t.uY()) {
			var e = t.TY,
			s = this.DY,
			n = t.hw;
			this.dY[t.f] = t,
			i(s, e, n),
			this.JY(s, t)
		}
	},
	SY: function(t) {
		if (!t._stopped) {
			var i = this.KE.Bw(t),
			e = [];
			for (var s in this.JW) {
				var n = this.JW[s];
				n.options.Qr && n.jY(i) && (T.Pq.KY(t), e.push(n))
			}
			e.sort(function(t, i) {
				return t.zindex - i.zindex
			}),
			e.length > 0 && this.kY(e, t, t.type)
		}
	},
	LY: function(t, i) {
		var e, s;
		if (!this.lY || this._prehoveredLayer != this.lY) {
			for (e in this.dY) if (s = this.dY[e], s.options.Qr && s.jY(i)) {
				T.mQ.rq(this.ow, "tdt-interactive"),
				this._prehoveredLayer = this.lY,
				this.lY = s,
				this._prehoveredLayer != this.lY && this.kY([s], t, "mouseover");
				break
			}
			this.lY && this._prehoveredLayer != this.lY && this.kY([this.lY], t)
		}
	},
	sY: function(t, i) {
		var e = this.lY; ! e || "mouseout" !== t.type && e.jY(i) || (T.mQ.tq(this.ow, "tdt-interactive"), this.kY([e], t, "mouseout"), this.lY = null)
	},
	kY: function(t, i, e) {
		this.PE(i, e || i.type, [t[0]])
	},
	PE: function(t, i, e) {
		if (!t._stopped && (e = (e || []).concat(this.KE.UE(t, i)), e.length)) {
			var s = e[0];
			"contextmenu" === i && s.eQ(i, !0) && T.Pq.preventDefault(t);
			var n = {
				originalEvent: t
			};
			if ("keypress" !== t.type) {
				var o = !!s.pE;
				n.lnglat = o ? s.pE() : this.KE.dw(n.layerPoint)
			}
			for (var h = 0; h < e.length; h++) if (e[h].EQ(i, n, !0), n.originalEvent._stopped || e[h].options.AE && T.s.indexOf(e[h].options.AE, i) !== -1) return
		}
	}
}),
T.GridlineLayer = T.TileLayer.extend({
	options: {
		te: 256,
		minZoom: 1,
		maxZoom: 18,
		opacity: 1,
		outlineSize: {
			width: 1,
			style: "solid",
			color: "#999"
		},
		textSize: {
			display: !1,
			fontSize: "14",
			fontWeight: !0,
			color: "black"
		}
	},
	setOptions: function(t, i) {
		for (var e in i)"outlineSize" != e && "textSize" != e && (t[e] = i[e]);
		return t
	},
	initialize: function(t) {
		t && t.size && (this.options.te = t.size),
		this.options.outlineSize = this.setOptions(this.options.outlineSize, t.outlineSize),
		this.options.textSize = this.setOptions(this.options.textSize, t.textSize),
		this.setOptions(this.options, t)
	},
	he: function(t, i) {
		var e = this.options,
		s = e.textSize,
		n = e.outlineSize,
		o = document.createElement("div");
		return s.display && (o.innerHTML = [t.x, t.y, t.z].join(", "), o.style.fontWeight = s.fontWeight ? "bold": "normal", o.style.fontSize = s.fontSize + "px", o.style.color = s.color, o.style.textAlign = "center", o.style.height = e.te + "px", o.style.width = e.te + "px", o.style.lineHeight = e.te + "px", o.style.display = "block", o.style.wordBreak = "keep-all", o.style.whiteSpace = "nowrap", o.style.overflow = "hidden", o.style.textoverflow = "ellipsis"),
		o.style.outline = n.width + "px " + n.style + " " + n.color,
		setTimeout(function() {
			i(null, o)
		},
		50 + 10 * Math.random()),
		o
	}
}),
T.PaintBrushTool = T.Tool.extend({
	options: {
		keepdrawing: !0,
		style: {
			color: "blue",
			weight: 10,
			opacity: .5
		}
	},
	initialize: function(t, i) {
		T.setOptions(this, i),
		this.KE = t;
		var e = T.PQ.touch;
		this.mousemove = e ? "touchmove": "mousemove",
		this.mouseFire = e ? "touchend": "mouseup",
		this.mousedown = e ? "touchstart": "mousedown",
		this.layers = new T.LayerGroup,
		this.KE.addLayer(this.layers)
	},
	enable: function() {
		this.TU || (this.TU = !0, this.AU())
	},
	disable: function() {
		this.TU && (this.TU = !1, this.Sr())
	},
	open: function() {
		this.enable()
	},
	close: function() {
		this.disable()
	},
	getLayers: function() {
		return this.layers.getLayers()
	},
	clear: function() {
		this.layers.clearLayers()
	},
	AU: function() {
		this.KE && (this.KE.disableDrag(), this.ow = this.KE.getContainer(), this.KE.on(this.mousemove, this._s, this), this.KE.on(this.mousedown, this.ms, this), T.Pq.on(document, this.mouseFire, this.QD, this), T.mQ.oq(), this.KE.getContainer().style.cursor = "crosshair")
	},
	Sr: function() {
		this.KE && (this.KE.enableDrag(), this.KE.off(this.mousemove, this._s, this), this.KE.off(this.mousedown, this.ms, this), T.mQ.pq(), T.Pq.on(document, this.mouseFire, this.QD, this), this.KE.getContainer().style.cursor = "")
	},
	_s: function(t) {
		if (this.DragLayer) {
			var i = t.lnglat,
			e = this.DragLayer.getLngLats();
			e.push(i),
			this.DragLayer.setLngLats(e),
			this.KE.getContainer().style.cursor = "pointer"
		}
	},
	ms: function(t) {
		this.DragLayer = new T.Polyline([], this.options.style),
		this.layers.addLayer(this.DragLayer)
	},
	QD: function(t) {
		this.DragLayer && (this.DragLayer = null, this.KE.getContainer().style.cursor = "crosshair", this.options.keepdrawing || this.disable())
	}
});